/* ==========================================
   THEME VARIABLES
========================================== */
:root {
    --bg-gradient: linear-gradient(120deg,#2A7C4B,#82c9a0);
    --card-bg: white;
    --text-color: #333;
    --header-text: white;
    --accent: #ff9f43;
    --input-bg: rgba(255, 255, 255, 0.3);
}

body.dark-mode {
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --card-bg: #2a2a40;
    --text-color: #e0e0e0;
    --input-bg: rgba(255, 255, 255, 0.1);
}

/* ==========================================
   GLOBAL LAYOUT
========================================== */
html, body {
    height: 100%;
    margin: 20;
}

body {
    display: flex;
    flex-direction: column;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-color);
    transition: 0.5s;
}

/* ==========================================
   HEADER (DESKTOP)
========================================== */
header {
    position: relative;
    padding: 30px 20px 10px;
    color: var(--header-text);
    text-align: center;
}

.header-logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 350px;
    height: 100px;
    object-fit: contain;
}

.header-title {
    text-align: right;
    font-size: clamp(24px, 5vw, 32px);
    font-weight: bold;
    padding-right: 200px;
}

.header-divider {
    width: 100%;
    height: 2px;
    background-color: rgba(255,255,255,0.5);
    margin: 20px auto;
    border-radius: 2px;
}

/* ==========================================
   TIP BOX
========================================== */
#tip-box {
    max-width: 600px;
    margin: 10px auto 20px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: white;
    text-align: center;
    font-style: italic;
    font-size: 14px;
    backdrop-filter: blur(5px);
}

/* ==========================================
   CONTROLS (SEARCH + TOGGLE)
========================================== */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
}

#searchInput {
    flex: 1;
    max-width: 500px;
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    background: var(--input-bg);
    color: white;
}

#searchInput::placeholder {
    color: rgba(255,255,255,0.8);
}

/* ==========================================
   FAVORITES SECTION
========================================== */
#favorites-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, 180px); /* fixed card width */
    justify-content: center; /* center all rows */
    gap: 20px;
    padding: 0px 0px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255,255,255,0.1);
    border-radius: 30px;
}

.category-title {
    color: white;
    font-size: 20px;
    margin: 0 0 15px 40px;
    font-weight: bold;
}

/* ==========================================
   GRID + CARDS
========================================== */
/*.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    padding: 20px 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.card-wrapper { position: relative; } */


/* Base state for each tile */
#mainGrid .card-wrapper {
    transform-origin: center center;
    transition: transform 0.2s ease-out;   /* adjust speed here */
    position: relative;      /* needed so z-index works */
    z-index: 1;              /* normal level */
}

/* Zoom on hover / touch */
#mainGrid .card-wrapper:hover,
#mainGrid .card-wrapper:active {
    transform: scale(1.3);                /* 1.0 = normal, 1.06 = 6% bigger */
    z-index: 10;             /* higher than neighbors */
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 180px); /* fixed card width */
    justify-content: center; /* center all rows */
    gap: 20px;
    padding: 20px 10px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}
 

.card {
    background: var(--card-bg);
    border-radius: 20px;
    text-align: center;
    padding: 25px 15px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 8px 18px rgba(0,0,0,0.2);
    transition: 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    box-sizing: border-box; 
    border-color: 0.4s ease;
}

.card:hover { transform: translateY(-8px); }

.card img {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    object-fit: contain;
}

.card span {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

/*.card:hover {
    transform: translateY(-8px);
    /*box-shadow:
        0 0 12px rgba(59, 130, 246, 0.7),
        0 0 24px rgba(59, 130, 246, 0.5);
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow:
        0 0 12px rgba(0, 200, 255, 0.8),
        0 0 24px rgba(0, 200, 255, 0.6);
    border-color: rgba(0, 200, 255, 1);
}*/

body.dark-mode .card:hover {
    transform: translateY(-8px);
    box-shadow:
        0 0 12px rgba(0, 200, 255, 0.8),
        0 0 24px rgba(0, 200, 255, 0.6);
    border-color: rgba(0, 200, 255, 1);
}

body:not(.dark-mode) .card:hover {
    transform: translateY(-8px);
    /*border-width: 2px;
    border-style: solid;*/
     box-shadow:
        0 0 10px rgb(0, 0, 0, 0.9),
        0 0 22px rgb(251, 1, 1);
    border-color: rgba(0, 0, 0, 0.9);
}

.card-wrapper {
    width: 180px; /* required for perfect alignment */
    position: relative;
}

/*.card-wrapper[data-id="nrk"] .card:hover {
    box-shadow:
        0 0 12px rgba(0, 200, 255, 0.8),
        0 0 24px rgba(0, 200, 255, 0.6);
    border-color: rgba(0, 200, 255, 1);
}

.card-wrapper[data-id="gange"] .card:hover {
    box-shadow:
        0 0 12px rgba(34, 197, 94, 0.8),
        0 0 24px rgba(34, 197, 94, 0.6);
    border-color: rgba(34, 197, 94, 1);
}*/

/* ==========================================
   FAVORITE STAR BUTTON
========================================== */
.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    filter: grayscale(1);
    z-index: 5;
    transition: 0.2s;
}
.fav-btn.active { filter: grayscale(0); transform: scale(1.2); }

/* ==========================================
   DARK MODE SWITCH
========================================== */
.switch-box { display: flex; align-items: center; gap: 10px; color: white; cursor: pointer; }
.switch { position: relative; width: 40px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 20px; transition: 0.4s; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.4s; }
input:checked + .slider { background: #7d8b7b; }
input:checked + .slider:before { transform: translateX(20px); }

/* ==========================================
   FOOTER
========================================== */
footer {
    margin-top: auto;
    text-align: center;
    padding: 15px 0;
    font-size: 14px;
    color: white;
    opacity: 0.8;
}

/* ==========================================
   MODAL
========================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.modal-btn,
.modal-close {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
}

.modal-btn { background: #007bff; color: white; }
.modal-close { background: #ccc; }

/* ==========================================
   MOBILE RESPONSIVE FIXES
========================================== */
@media (max-width: 768px) {

    /* Header becomes centered */
    header {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px 10px;
    }

    .header-logo {
        position: static;
        transform: none;
        width: 180px;
        height: auto;
        margin-bottom: 10px;
    }

    .header-title {
        padding-right: 0;
        text-align: center;
        width: 100%;
        font-size: 22px;
    }

    /* Controls stack */
    .controls {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 30px;
    }

    #searchInput {
        max-width: 100%;
    }

    /* Footer centered */
    footer {
        text-align: center;
        padding: 20px 0;
    }
}
/* ==========================================
   IPAD / TABLET FIXES (iPad Air, iPad Pro)
========================================== */
@media (max-width: 1024px) {

    header {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 25px 10px;
    }

    .header-logo {
        position: static;
        transform: none;
        width: 220px;   /* slightly larger than mobile */
        height: auto;
        margin-bottom: 15px;
    }

    .header-title {
        padding-right: 0;
        text-align: center;
        width: 100%;
        font-size: 26px; /* readable on iPad */
    }
}