/* =================================== */
/* CSS VARIABLES & THEMES       */
/* =================================== */
:root {
    --header-height: 75px;
    --sidebar-width: 280px;

    /* Dark Theme (Default) */
    --bg-gradient: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --text-primary: white;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-placeholder: rgba(255, 255, 255, 0.6);
    
    --header-bg: rgba(15, 32, 39, 0.5);
    --sidebar-bg: rgba(15, 32, 39, 0.5);
    --mobile-sidebar-bg: rgba(15, 32, 39, 0.8);

    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-hover-bg: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(255, 255, 255, 0.25);
    --card-shadow: rgba(0,0,0,0.2);
    --card-hover-shadow: rgba(0,0,0,0.3);
    
    --button-bg: rgba(255, 255, 255, 0.1);
    --button-border: rgba(255, 255, 255, 0.2);
    --button-hover-bg: rgba(255, 255, 255, 0.2);
    --button-hover-border: rgba(255, 255, 255, 0.4);

    --filter-bg: rgba(255, 255, 255, 0.05);
    --filter-border: rgba(255, 255, 255, 0.15);
    --filter-active-bg: rgba(255, 255, 255, 0.2);
    --filter-active-border: rgba(255, 255, 255, 0.4);
    
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-border: rgba(255, 255, 255, 0.2);

    --modal-bg: rgba(44, 83, 100, 0.6);
    --modal-border: rgba(255,255,255,0.2);
    --modal-tag-bg: rgba(0,0,0,0.2);

    --glow-bg: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 50%);
}

.light-theme {
    /* Light Theme */
    --bg-gradient: linear-gradient(135deg, #eef2f3, #dce3e4, #ffffff);
    --text-primary: #1d2d35;
    --text-secondary: #34495e;
    --text-placeholder: rgba(0, 0, 0, 0.5);

    --header-bg: rgba(255, 255, 255, 0.5);
    --sidebar-bg: rgba(255, 255, 255, 0.5);
    --mobile-sidebar-bg: rgba(255, 255, 255, 0.85);

    --card-bg: rgba(255, 255, 255, 0.4);
    --card-border: rgba(0, 0, 0, 0.08);
    --card-hover-bg: rgba(255, 255, 255, 0.7);
    --card-hover-border: rgba(0, 0, 0, 0.15);
    --card-shadow: rgba(0,0,0,0.1);
    --card-hover-shadow: rgba(0,0,0,0.15);
    
    --button-bg: rgba(0, 0, 0, 0.05);
    --button-border: rgba(0, 0, 0, 0.1);
    --button-hover-bg: rgba(0, 0, 0, 0.08);
    --button-hover-border: rgba(0, 0, 0, 0.2);

    --filter-bg: rgba(0, 0, 0, 0.04);
    --filter-border: rgba(0, 0, 0, 0.1);
    --filter-active-bg: rgba(44, 83, 100, 0.8);
    --filter-active-border: rgba(44, 83, 100, 0.9);
    
    --input-bg: rgba(255, 255, 255, 0.2);
    --input-border: rgba(0, 0, 0, 0.15);
    
    --modal-bg: rgba(238, 242, 243, 0.7);
    --modal-border: rgba(0,0,0,0.1);
    --modal-tag-bg: rgba(0,0,0,0.1);
    
    --glow-bg: radial-gradient(circle, rgba(0,0,0,0.03) 0%, transparent 50%);
}

.light-theme .filter-button.active { color: white; }
.light-theme .telegram-button { color: var(--text-primary); }

/* =================================== */
/* BASE STYLES             */
/* =================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}
body::before { content: ''; position: fixed; top: -50%; left: -50%; width: 200%; height: 200%; background: var(--glow-bg); animation: glowMove 15s infinite linear; z-index: -1; }
@keyframes glowMove { 0% { transform: translate(0, 0); } 50% { transform: translate(15%, 10%); } 100% { transform: translate(0, 0); } }

/* =================================== */
/* HEADER & NAVIGATION       */
/* =================================== */
.glass-header { background: var(--header-bg); backdrop-filter: blur(12px); border-bottom: 1px solid var(--card-border); padding: 0 30px; height: var(--header-height); width: 100%; position: fixed; top: 0; z-index: 998; box-shadow: 0 4px 20px var(--card-shadow); display: flex; align-items: center; }
.header-container { display: flex; justify-content: space-between; align-items: center; width: 100%; margin: 0 auto; gap: 20px; }
.site-logo { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 600; color: var(--text-primary); text-decoration: none; flex-shrink: 0; }
.site-logo img { height: 32px; width: 32px; object-fit: contain; }
.nav-links { display: flex; align-items: center; justify-content: flex-end; gap: 15px; width: 100%; min-width: 0; }
.nav-links a { text-decoration: none; color: var(--text-secondary); font-weight: 500; padding: 8px 14px; border-radius: 8px; transition: all 0.25s ease-out; white-space: nowrap; }
.nav-links a:hover { background: var(--button-bg); color: var(--text-primary); }
.theme-toggle-btn { background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 5px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.theme-toggle-btn:hover { background: var(--button-hover-bg); }
.theme-toggle-btn svg { width: 20px; height: 20px; }
.search-bar { position: relative; min-width: 150px; max-width: 220px; width: 100%; }
#search-input, #mobile-search-input { padding: 8px 14px; border: 1px solid var(--input-border); border-radius: 10px; font-size: 14px; background: var(--input-bg); color: var(--text-primary); backdrop-filter: blur(8px); outline: none; width: 100%; transition: all 0.25s ease-out; }
#search-input:focus, #mobile-search-input:focus { border-color: var(--filter-active-border); }

/* =================================== */
/* SIDEBAR & FILTERS            */
/* =================================== */
.main-layout { margin-left: var(--sidebar-width); padding-top: var(--header-height); }
.content-area { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 40px; }
.filter-sidebar { position: fixed; top: var(--header-height); left: 0; width: var(--sidebar-width); height: calc(100vh - var(--header-height)); background: var(--sidebar-bg); backdrop-filter: blur(12px); border-right: 1px solid var(--card-border); padding: 25px; overflow-y: auto; z-index: 900; }
.sidebar-header, .sidebar-nav { display: none; }
.filter-container h4 { margin-top: 20px; margin-bottom: 12px; font-size: 18px; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--card-border); padding-bottom: 8px; }
.filter-container h4:first-child { margin-top: 0; }
.filter-container > div { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-button { padding: 8px 16px; font-size: 14px; font-weight: 500; color: var(--text-secondary); background: var(--filter-bg); border: 1px solid var(--filter-border); border-radius: 10px; cursor: pointer; transition: all 0.25s ease-out; }
.filter-button:hover { background: var(--button-hover-bg); border-color: var(--button-hover-border); }
.filter-button.active { background: var(--filter-active-bg); color: var(--text-primary); border-color: var(--filter-active-border); box-shadow: 0 0 12px rgba(255,255,255,0.15); }
.sidebar-tools { margin-top: 25px; padding-top: 25px; border-top: 1px solid var(--card-border); }
.sidebar-tools h4 { margin-bottom: 12px; font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.random-btn { width: 100%; display: flex; justify-content: center; align-items: center; gap: 10px; }

/* =================================== */
/* CARDS & CONTENT            */
/* =================================== */
.cards-section { text-align: center; padding: 40px 0; }
.cards-section h2 { font-size: 42px; margin-bottom: 15px; font-weight: 600; text-shadow: 0 0 15px var(--card-shadow); }
.subtitle { color: var(--text-secondary); font-size: 18px; margin-bottom: 40px; }
.cards-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; margin: 0 auto; }
.glass-card { position: relative; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; backdrop-filter: blur(10px); padding: 25px 20px; box-shadow: 0 8px 20px var(--card-shadow); text-align: center; transition: all 0.25s ease-out; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.glass-card:hover { transform: translateY(-8px); background: var(--card-hover-bg); border-color: var(--card-hover-border); box-shadow: 0 16px 30px var(--card-hover-shadow), 0 0 12px rgba(255,255,255,0.1); }
.card-content { display: flex; flex-direction: column; align-items: center; justify-content: space-between; width: 100%; height: 100%; cursor: pointer; }
.glass-card img { width: 52px; height: 52px; object-fit: contain; margin-bottom: 15px; filter: drop-shadow(0 4px 5px var(--card-shadow)); }
.glass-card h3 { font-size: 18px; margin: 8px 0; flex-grow: 1; font-weight: 600; }
.glass-button { display: inline-block; padding: 10px 20px; background: var(--button-bg); color: var(--text-primary); border: 1px solid var(--button-border); border-radius: 10px; backdrop-filter: blur(10px); transition: all 0.25s ease-out; text-decoration: none; font-size: 14px; font-weight: 500; margin-top: 15px; width: 90%; cursor: pointer; }
.glass-button:hover { background: var(--button-hover-bg); transform: scale(1.05); border-color: var(--button-hover-border); box-shadow: 0 0 12px rgba(255,255,255,0.2); }
.contact-section { text-align: center; padding: 60px 20px; }
.telegram-button { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--button-bg); border: 1px solid var(--button-border); border-radius: 12px; color: var(--text-primary); text-decoration: none; font-size: 16px; transition: all 0.3s ease; }
.telegram-button:hover { transform: scale(1.05); background: var(--button-hover-bg); }
.telegram-button img { filter: drop-shadow(0 0 2px var(--card-shadow)); }
.error-message { color: var(--text-secondary); font-size: 18px; width: 100%; text-align: center; grid-column: 1 / -1; }

/* =================================== */
/* HOVER PREVIEW                */
/* =================================== */
.card-preview { position: absolute; bottom: 105%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 250px; padding: 12px 15px; background: var(--modal-bg); border: 1px solid var(--modal-border); border-radius: 10px; backdrop-filter: blur(15px); box-shadow: 0 8px 20px var(--card-shadow); text-align: left; font-size: 13px; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.2s ease, visibility 0.2s ease; transition-delay: 0.3s; z-index: 10; }
.preview-item { color: var(--text-secondary); white-space: normal; }
.preview-item:not(:last-child) { margin-bottom: 8px; }
.preview-item strong { color: var(--text-primary); }
.glass-card:hover .card-preview { opacity: 1; visibility: visible; transition-delay: 0.5s; }

/* =================================== */
/* COMPARISON FEATURE           */
/* =================================== */
.compare-btn { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: var(--button-bg); border: 1px solid var(--button-border); color: var(--text-primary); font-size: 24px; line-height: 28px; cursor: pointer; transition: all 0.2s ease; z-index: 5; }
.compare-btn:hover { background: var(--button-hover-bg); transform: scale(1.1); }
.compare-btn.added { background: var(--filter-active-bg); border-color: var(--filter-active-border); color: white; transform: rotate(45deg); }
.light-theme .compare-btn.added { color: white; }
.comparison-tray { position: fixed; bottom: -100px; left: 0; width: 100%; z-index: 997; transition: bottom 0.3s ease-in-out; }
.comparison-tray.open { bottom: 0; }
.comparison-tray-content { max-width: 600px; margin: 0 auto 20px auto; background: var(--header-bg); backdrop-filter: blur(15px); border: 1px solid var(--card-border); border-radius: 16px; padding: 10px 20px; box-shadow: 0 -5px 30px var(--card-shadow); display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.comparison-items { display: flex; gap: 15px; align-items: center; }
.comparison-items img { width: 40px; height: 40px; object-fit: contain; }
.comparison-actions { display: flex; align-items: center; gap: 15px; }
#compare-now-btn { margin: 0; padding: 8px 16px; width: auto; white-space: nowrap; }
#compare-now-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.clear-comparison-btn { width: 28px; height: 28px; background: none; border: 1px solid var(--button-border); color: var(--text-secondary); border-radius: 50%; cursor: pointer; font-size: 20px; }
.clear-comparison-btn:hover { background: var(--button-hover-bg); color: var(--text-primary); }
.comparison-modal-content { background: var(--modal-bg); backdrop-filter: blur(15px); border: 1px solid var(--modal-border); padding: 30px; border-radius: 20px; width: 95%; max-width: 1000px; position: relative; box-shadow: 0 8px 32px 0 var(--card-shadow); }
.comparison-modal-content h3 { text-align: center; font-size: 28px; margin-bottom: 25px; }
.comparison-grid { display: grid; gap: 10px; align-items: center; }
.compare-header { text-align: center; font-size: 18px; }
.compare-header.hidden { visibility: hidden; }
.compare-header img { width: 48px; height: 48px; object-fit: contain; margin-bottom: 8px; }
.compare-row-title { font-weight: bold; text-align: right; padding-right: 15px; }
.compare-cell { background: var(--modal-tag-bg); padding: 12px 15px; border-radius: 8px; height: 100%; display: flex; align-items: center; }
.compare-cell .glass-button { width: 100%; margin: 0; }

/* =================================== */
/* MODALS & OVERLAY           */
/* =================================== */
.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); justify-content: center; align-items: center; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { background: var(--modal-bg); backdrop-filter: blur(15px); border: 1px solid var(--modal-border); margin: auto; padding: 30px; border-radius: 20px; width: 90%; max-width: 500px; position: relative; box-shadow: 0 8px 32px 0 var(--card-shadow); animation: slideIn 0.4s ease-out; }
@keyframes slideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close-button { color: #aaa; position: absolute; top: 15px; right: 20px; font-size: 28px; font-weight: bold; cursor: pointer; transition: color 0.2s; }
.modal-close-button:hover { color: var(--text-primary); }
.modal-header { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.modal-header img { width: 48px; height: 48px; object-fit: contain; }
.modal-header h2 { margin: 0; font-size: 28px; }
.modal-content p { font-size: 16px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 25px; }
.modal-details-grid { display: grid; gap: 15px; margin-bottom: 30px; }
.modal-detail-item { display: flex; justify-content: space-between; align-items: center; background: var(--modal-tag-bg); padding: 10px 15px; border-radius: 8px; }
.modal-detail-item span:first-child { display: flex; align-items: center; gap: 8px; }
.info-icon { font-size: 12px; color: var(--text-secondary); cursor: pointer; border: 1px solid var(--card-border); border-radius: 50%; width: 18px; height: 18px; display: inline-flex; justify-content: center; align-items: center; transition: all 0.2s ease; }
.info-icon:hover { background: var(--button-bg); color: var(--text-primary); }
.definition-modal-content { background: var(--modal-bg); backdrop-filter: blur(15px); border: 1px solid var(--modal-border); padding: 25px; border-radius: 16px; width: 90%; max-width: 400px; position: relative; box-shadow: 0 8px 32px 0 var(--card-shadow); animation: slideIn 0.3s ease-out; }
.definition-modal-content h3 { font-size: 22px; margin-bottom: 15px; }
.definition-modal-content p { font-size: 16px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 25px; }
.definition-modal-content .glass-button { width: 100%; text-align: center; }
#overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; transition: opacity 0.3s ease; opacity: 0; }
#overlay.open { display: block; opacity: 1; }

/* =================================== */
/* MOBILE RESPONSIVE STYLES       */
/* =================================== */
.menu-toggle { display: none; flex-direction: column; justify-content: space-around; width: 30px; height: 25px; background: transparent; border: none; cursor: pointer; padding: 0; z-index: 1002; }
.menu-toggle .bar { width: 100%; height: 3px; background-color: var(--text-primary); border-radius: 10px; transition: all 0.3s ease-in-out; }
.menu-toggle.open .bar:nth-child(1) { transform: rotate(45deg) translate(7px, 7px); }
.menu-toggle.open .bar:nth-child(2) { opacity: 0; }
.menu-toggle.open .bar:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }
@media (max-width: 1024px) {
    .header-container { max-width: 100%; }
    .nav-links { display: none; }
    .menu-toggle { display: flex; }
    .main-layout { margin-left: 0; }
    .content-area { padding: 0 15px; }
    .filter-sidebar { position: fixed; top: 0; left: auto; right: -300px; width: 300px; height: 100%; background: var(--mobile-sidebar-bg); z-index: 1000; transition: right 0.3s ease-in-out; padding: 20px; padding-top: 70px; box-shadow: -10px 0 30px var(--card-shadow); border-right: none; }
    .filter-sidebar.open { right: 0; }
    .sidebar-header { display: flex; justify-content: space-between; align-items: center; position: absolute; top: 15px; left: 20px; right: 20px; }
    .sidebar-header h3 { font-size: 22px; }
    .close-sidebar-btn { background: none; border: none; color: var(--text-primary); font-size: 32px; cursor: pointer; }
    .sidebar-nav { display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--card-border); padding-bottom: 20px; margin-bottom: 20px; }
    .sidebar-nav a { color: var(--text-primary); text-decoration: none; font-size: 18px; padding: 10px; border-radius: 8px; }
    .sidebar-nav a:hover { background: var(--button-hover-bg); }
    .sidebar-nav .search-bar #mobile-search-input { width: 100%; }
    .sidebar-nav .theme-toggle-btn { display: flex; align-items: center; gap: 15px; width: 100%; padding: 10px; font-size: 18px; color: var(--text-primary); justify-content: flex-start; }
    .sidebar-nav .theme-toggle-btn:hover { background: var(--button-hover-bg); }
    .cards-section { padding-top: 20px; }
}
@media (max-width: 768px) {
    .glass-header { padding: 0 20px; }
    .cards-section h2 { font-size: 32px; }
    .subtitle { font-size: 16px; }
    .cards-container { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
    .glass-card h3 { font-size: 16px; }
}
@media (max-width: 640px) {
    .comparison-tray-content { flex-direction: column; gap: 15px; padding: 15px; }
    .comparison-modal-content { padding: 15px; }
    .comparison-grid { font-size: 12px; gap: 5px; }
    .compare-header h4 { font-size: 14px; }
    .compare-cell .glass-button { font-size: 12px; padding: 8px 10px; }
}
@media (max-width: 480px) {
    .cards-container { grid-template-columns: 1fr 1fr; gap: 15px; }
    .glass-card { padding: 20px 15px; }
}



/* =================================== */
/* CARD ENTRANCE ANIMATION      */
/* =================================== */

@keyframes cardEnterAnimation {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-enter-animation {
  /* Start hidden before animation begins */
  opacity: 0; 
  animation: cardEnterAnimation 0.5s ease forwards;
}