/* =========================================
   1. VARIABLES & THEME (Light/Dark Mode)
   ========================================= */
:root {
    /* LIGHT MODE DEFAULTS */
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #dddddd;
    --primary: #007bff;        /* Blue */
    --primary-hover: #0056b3;
    --action-btn: #6f42c1;     /* Purple for Analyze */
    --action-hover: #5a32a3;
    --nav-bg: #ffffff;
    --nav-shadow: rgba(0,0,0,0.1);
    
    /* Status Colors */
    --safe-bg: #d4edda;
    --safe-text: #155724;
    --safe-border: #c3e6cb;
    
    --danger-bg: #f8d7da;
    --danger-text: #721c24;
    --danger-border: #f5c6cb;
    
    --caution-bg: #fff3cd;
    --caution-text: #856404;
    --caution-border: #ffeeba;

    --ai-box-bg: #e8f0fe;
    --ai-box-text: #1a73e8;
    --ai-box-border: #1a73e8;
}

[data-theme="dark"] {
    /* DARK MODE OVERRIDES */
    --bg-color: #18191a;
    --card-bg: #242526;
    --text-color: #e4e6eb;
    --border-color: #3e4042;
    --primary: #4595eb;
    --primary-hover: #357abd;
    --action-btn: #8a63d2;
    --action-hover: #6f42c1;
    --nav-bg: #242526;
    --nav-shadow: rgba(255,255,255,0.1);
    
    /* Dark Mode Status Colors (Muted for readability) */
    --safe-bg: #1e3a29;
    --safe-text: #75b798;
    --safe-border: #2b543a;
    
    --danger-bg: #4a1e23;
    --danger-text: #ea868f;
    --danger-border: #6a2e35;
    
    --caution-bg: #423818;
    --caution-text: #ffda6a;
    --caution-border: #665624;

    --ai-box-bg: #1c2b42;
    --ai-box-text: #8ab4f8;
    --ai-box-border: #4285f4;
}

/* =========================================
   2. BASE STYLES
   ========================================= */
body {
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* =========================================
   3. NAVBAR (Fixed Top)
   ========================================= */
.navbar {
    width: 100%;
    background: var(--nav-bg);
    padding: 15px 20px;
    box-shadow: 0 2px 10px var(--nav-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    position: sticky;
    top: 0;
 z-index: 9999; 
}

.logo-group {
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-item {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item:hover {
    color: var(--primary);
}

.theme-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 5px;
}

/* =========================================
   4. MAIN CONTAINER & CARDS
   ========================================= */
.container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 90%;
    max-width: 500px;
    margin-top: 40px;
    margin-bottom: 40px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.title { margin-top: 0; font-size: 28px; }
.subtitle { color: #888; margin-bottom: 25px; }

/* =========================================
   5. TABS & INPUTS
   ========================================= */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-color);
    font-weight: 600;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

textarea {
    width: 100%;
    height: 120px;
    padding: 15px;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    resize: none;
    background: var(--bg-color);
    color: var(--text-color);
    margin-bottom: 10px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-color);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(0, 123, 255, 0.05);
}

.upload-icon { font-size: 40px; margin-bottom: 10px; }
.small-text { font-size: 0.9rem; color: #888; margin-top: 5px; }
.status-text { margin-top: 10px; font-weight: bold; color: var(--primary); }

/* =========================================
   6. BUTTONS
   ========================================= */
#analyzeBtn {
    background-color: var(--action-btn);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    width: 100%;
    font-weight: bold;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.3);
    transition: transform 0.1s, background-color 0.2s;
}

#analyzeBtn:hover { background-color: var(--action-hover); }
#analyzeBtn:active { transform: scale(0.98); }

.secondary-btn {
    width: 100%;
    padding: 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    transition: background 0.2s;
}

.secondary-btn:hover { background: var(--nav-bg); }

/* =========================================
   7. RESULTS & ALERTS
   ========================================= */
.result-card {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    display: none; /* Hidden by default */
}

.result-card.visible { display: block; }

.result-card h2 { margin-top: 0; font-size: 18px; margin-bottom: 5px; }
.status-icon { font-size: 30px; float: right; }
.confidence-text { font-size: 12px; opacity: 0.8; margin-top: 10px; font-weight: bold; text-transform: uppercase; }

/* Dynamic Status Colors */
.safe { background: var(--safe-bg); color: var(--safe-text); border: 1px solid var(--safe-border); }
.danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.caution { background: var(--caution-bg); color: var(--caution-text); border: 1px solid var(--caution-border); }

/* AI Analysis Box */
.ai-box {
    background: var(--ai-box-bg);
    color: var(--ai-box-text);
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    border-left: 4px solid var(--ai-box-border);
    text-align: left;
    margin-top: 10px;
    line-height: 1.5;
}

#aiText strong { color: var(--ai-box-border); }

/* =========================================
   8. TECHNICAL DETAILS DROPDOWN
   ========================================= */
.tech-details {
    margin-top: 20px;
    border: none;
    background: transparent;
}

/* The "Button" looking Summary */
.tech-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    list-style: none; 
    transition: background 0.2s;
    box-sizing: border-box;
}

.tech-btn::-webkit-details-marker { display: none; }
.tech-btn:hover { background: var(--nav-bg); }

/* The Hidden Content */
.tech-content {
    margin-top: 15px;
    padding: 15px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: left;
    color: var(--text-color);
}

.tech-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 13px;
    color: var(--text-color);
    margin-bottom: 10px;
}

.tech-info-grid p { margin: 2px 0; }

/* LIME Charts */
.lime-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lime-row { display: flex; align-items: center; font-size: 14px; }
.lime-label { width: 80px; text-align: right; margin-right: 10px; font-weight: bold; opacity: 0.8; }
.lime-bar-container { flex-grow: 1; background: #eee; height: 10px; border-radius: 5px; overflow: hidden; }
.lime-bar { height: 100%; }
.danger-bar { background-color: #dc3545; }
.safe-bar { background-color: #28a745; }

/* =========================================
   9. ABOUT PAGE SPECIFICS
   ========================================= */
.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 30px 0;
}

h2 { color: var(--primary); margin-bottom: 15px; }
h3 { margin-top: 0; color: var(--text-color); }
ul li { margin-bottom: 8px; color: var(--text-color); }

table td, table th { color: var(--text-color); }

/* =========================================
   10. UTILITIES
   ========================================= */
.hidden { display: none !important; }

/* Mobile Adjustments */
@media (max-width: 600px) {
    .container { 
        width: 90%;          /* Changed from 100% to 90% so it doesn't touch edges */
        max-width: 100%;     /* Ensure it doesn't overflow */
        border-radius: 12px; /* Keep rounded corners on mobile */
        box-shadow: none; 
        margin-top: 20px;    /* Add some space from the navbar */
        min-height: auto;    /* Allow height to fit content */
        padding: 1.5rem;     /* Slightly less padding inside */
    }
    
    .navbar { 
        position: sticky; 
        top: 0; 
        z-index: 100; 
        padding: 15px 15px; /* Ensure navbar also has breathing room */
    }

    .tech-info-grid { 
        grid-template-columns: 1fr; /* Stack tech details on mobile */
    }
}
.logo-svg {
    margin-right: 10px;
    /* Adds a subtle shadow to make it pop */
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
    transition: transform 0.2s;
}

/* Optional: Slight hover effect */
.logo-group:hover .logo-svg {
    transform: scale(1.1);
}


/* Define the animation */
@keyframes logoPop {
    0% { transform: scale(0) rotate(-45deg); opacity: 0; }
    80% { transform: scale(1.2) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); }
}

/* Apply it to the logo */
.logo-icon {
    /* Existing styles... */
    width: 32px;
    height: 32px;
    margin-right: 8px;
    
    /* NEW ANIMATION LINE */
    animation: logoPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}


/* Optional: Ensure the text sits in the middle too */
.logo-text {
    /* Keep existing styles */
    opacity: 0; /* Start invisible */
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: 0.3s; /* Wait 0.3s before starting */
}


/* Define the animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px); /* Starts 30px lower */
    }
    to {
        opacity: 1;
        transform: translateY(0);    /* Ends in original position */
    }
}

/* Apply to main container or hero section */
.hero, .container {
    animation: fadeInUp 1s ease-out forwards;
}

.about-container {
    padding-top: 20px; /* Gives space if navbar is sticky */
    position: relative;
    z-index: 1; /* Lower than navbar */
}