/* ==========================================
   MTG Vault — Custom Styles
   Dark theme, MTG-inspired
   ========================================== */

/* --- Base --- */
body {
    background: #0d1117;
    color: #c9d1d9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
}

/* --- Navbar --- */
.navbar {
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.navbar-brand {
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

/* --- Hero Section --- */
.hero-section {
    padding: 2rem 0 1rem;
}
.hero-section h1 {
    background: linear-gradient(135deg, #58a6ff, #3fb950, #d2a8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Stat Cards --- */
.stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(88, 166, 255, 0.15);
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e6edf3;
}
.stat-label {
    font-size: 0.8rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Deck Cards --- */
.deck-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    overflow: hidden;
}
.deck-card .card-header {
    background: rgba(48, 54, 61, 0.5);
    border-bottom: 1px solid #30363d;
}
.deck-card .card-footer {
    background: rgba(48, 54, 61, 0.3);
    border-top: 1px solid #30363d;
}

/* --- Quick link cards --- */
.quick-link-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    transition: all 0.2s ease;
    color: #c9d1d9;
}
.quick-link-card:hover {
    background: #1c2333;
    border-color: #58a6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(88, 166, 255, 0.1);
    color: #e6edf3;
}

/* --- Color Pips (MTG mana identity) --- */
.color-pip {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    vertical-align: middle;
}
.pip-white { background: #f9faf4; }
.pip-blue { background: #0e68ab; }
.pip-black { background: #2b2826; border-color: rgba(255,255,255,0.5); }
.pip-red { background: #d3202a; }
.pip-green { background: #00733e; }

.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
}

/* --- Mana Symbols --- */
.mana-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    margin-right: 1px;
    color: #000;
    vertical-align: middle;
    line-height: 1;
}
.mana-inline {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
    min-width: 60px;
    width: 60px;
}

/* Mana colors */
.mana-w { background: #f9faf4; color: #333; }
.mana-u { background: #0e68ab; color: #fff; }
.mana-b { background: #2b2826; color: #c9c5c2; border: 1px solid #555; }
.mana-r { background: #d3202a; color: #fff; }
.mana-g { background: #00733e; color: #fff; }
.mana-c { background: #ccc2b6; color: #333; }

/* Colorless/generic */
.mana-0, .mana-1, .mana-2, .mana-3, .mana-4, .mana-5,
.mana-6, .mana-7, .mana-8, .mana-9, .mana-10, .mana-11, .mana-12,
.mana-x { background: #ccc2b6; color: #333; }

/* Hybrid */
.mana-gu, .mana-ug { background: linear-gradient(135deg, #00733e 50%, #0e68ab 50%); color: #fff; }
.mana-wb, .mana-bw { background: linear-gradient(135deg, #f9faf4 50%, #2b2826 50%); color: #333; }
.mana-up, .mana-bp, .mana-gp, .mana-rp, .mana-wp {
    background: #b33871; color: #fff;
}

/* --- Commander Image Frame --- */
.commander-frame {
    width: 120px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    border: 2px solid #30363d;
}
.commander-img {
    width: 100%;
    height: auto;
    display: block;
}
@media (max-width: 576px) {
    .commander-frame {
        width: 80px;
    }
}

/* --- Deck Header --- */
.deck-header {
    background: linear-gradient(135deg, rgba(22,27,34,0.9), rgba(13,17,23,0.9));
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 1.5rem;
}

/* --- Card List Items --- */
.list-group-item.card-link {
    transition: background-color 0.15s ease;
    padding: 0.6rem 1rem;
}
.list-group-item.card-link:hover {
    background: rgba(88, 166, 255, 0.08) !important;
}
.card-name-text {
    font-weight: 500;
}

/* --- Card Grid --- */
.card-grid-img {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.card-grid-img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(88, 166, 255, 0.3);
    z-index: 10;
    position: relative;
}

/* --- Card Preview (hover tooltip) --- */
.card-preview {
    position: fixed;
    display: none;
    z-index: 9999;
    pointer-events: none;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.6));
}
.card-preview img {
    width: 250px;
    border-radius: 12px;
}
@media (max-width: 768px) {
    .card-preview { display: none !important; }
}

/* --- Table --- */
.table-dark {
    --bs-table-bg: #0d1117;
    --bs-table-border-color: #30363d;
}
.table-dark thead {
    background: #161b22;
}
.collection-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 767.98px) {
    .collection-table-wrapper {
        overflow-x: visible;
    }
}
.table-header-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #161b22;
}
.table-header-sticky th {
    background: #161b22;
}
.card-row {
    transition: background-color 0.15s ease;
    cursor: pointer;
}
.card-row:hover {
    background: rgba(88, 166, 255, 0.06) !important;
}

/* --- Guide Content --- */
.guide-content {
    font-size: 0.95rem;
    line-height: 1.7;
}
.guide-content h1 {
    font-size: 1.8rem;
    color: #58a6ff;
    border-bottom: 1px solid #30363d;
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}
.guide-content h2 {
    font-size: 1.5rem;
    color: #3fb950;
    margin-top: 2rem;
    border-bottom: 1px solid rgba(63, 185, 80, 0.2);
    padding-bottom: 0.3rem;
}
.guide-content h3 {
    font-size: 1.25rem;
    color: #d2a8ff;
    margin-top: 1.5rem;
}
.guide-content h4, .guide-content h5 {
    color: #e6edf3;
    margin-top: 1.2rem;
}
.guide-content code {
    background: rgba(110, 118, 129, 0.2);
    border-radius: 4px;
    padding: 0.15em 0.4em;
    font-size: 0.88em;
    color: #79c0ff;
}
.guide-content pre {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
}
.guide-content pre code {
    background: transparent;
    color: #c9d1d9;
    padding: 0;
}
.guide-content blockquote {
    border-left: 4px solid #30363d;
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    background: rgba(22, 27, 34, 0.6);
    border-radius: 0 8px 8px 0;
    color: #8b949e;
}
.guide-content table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
}
.guide-content table th,
.guide-content table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #30363d;
}
.guide-content table th {
    background: #161b22;
    font-weight: 600;
}
.guide-content table tr:nth-child(even) {
    background: rgba(22, 27, 34, 0.4);
}
.guide-content hr {
    border-color: #30363d;
    margin: 2rem 0;
}
.guide-content a {
    color: #58a6ff;
}
.guide-content ul, .guide-content ol {
    padding-left: 1.5rem;
}
.guide-content li {
    margin-bottom: 0.3rem;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #0d1117;
}
::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* --- Misc --- */
.card {
    background: #161b22;
    border-color: #30363d;
}
.card-header {
    background: rgba(48, 54, 61, 0.5);
    border-color: #30363d;
}

/* --- Responsive tweaks --- */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 1.8rem;
    }
    .stat-value {
        font-size: 1.1rem;
    }
    .commander-frame {
        width: 80px;
    }
    .deck-header {
        padding: 1rem;
    }
}
@media (max-width: 576px) {
    main.container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    .card-grid-img:hover {
        transform: none;
    }
}

/* --- Page transitions --- */
main {
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Badge customizations --- */
.badge {
    font-weight: 500;
}

/* --- Pagination dark --- */
.page-link {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}
.page-link:hover {
    background: #1c2333;
    border-color: #58a6ff;
    color: #58a6ff;
}
.page-item.active .page-link {
    background: #58a6ff;
    border-color: #58a6ff;
    color: #fff;
}
.page-item.disabled .page-link {
    background: #0d1117;
    border-color: #30363d;
    color: #484f58;
}

/* --- Form controls dark override --- */
.form-control:focus, .form-select:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 0.15rem rgba(88, 166, 255, 0.25);
}
.form-select,
.form-select option {
    background-color: #161b22;
    color: #c9d1d9;
}
.form-select option:checked {
    background-color: #1c2333;
    color: #58a6ff;
}
.form-select option:hover {
    background-color: #1c2333;
}
