/* =========================================
   1. VARIABLES & BASE STYLES
========================================= */
:root {
    --primary: #f97316;
    --primary-hover: #ea580c;
    --dark: #1e293b;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #333333;
    --border: #cbd5e1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0; 
}

/* Layout */
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.container-small { max-width: 600px; margin: 0 auto; padding: 0 20px; }
.card { background: var(--card); padding: 30px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .grid { grid-template-columns: 1fr; } }


/* =========================================
   2. HEADER & NAVIGATION (DESKTOP)
========================================= */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    margin-bottom: 30px;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    height: 40px;
    width: auto;
    display: block;
}

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

.main-nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

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

.nav-highlight {
    color: var(--primary) !important;
    font-weight: bold !important;
}

/* --- THE AVATAR FIX --- */
.profile-link {
    display: flex;
    align-items: center;
}

.header-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important; /* Forces a perfect circle */
    object-fit: cover !important;  /* Prevents the image from squishing */
    border: 2px solid var(--primary) !important; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    display: inline-block !important;
    vertical-align: middle;
}


/* =========================================
   3. FORMS & BUTTONS
========================================= */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: bold; color: #64748b; text-transform: uppercase; margin-bottom: 8px; }

.form-control { 
    width: 100%; 
    padding: 12px; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    font-size: 1rem; 
    box-sizing: border-box; 
    font-family: inherit; 
    transition: all 0.2s; 
}

.form-control:focus { 
    outline: none; 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2); 
}

textarea.form-control { min-height: 120px; resize: vertical; }

.btn { 
    display: inline-block; 
    padding: 12px 24px; 
    font-size: 1rem; 
    font-weight: bold; 
    text-align: center; 
    border-radius: 8px; 
    cursor: pointer; 
    text-decoration: none; 
    border: none; 
    transition: background 0.2s; 
    box-sizing: border-box; 
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #e2e8f0; color: var(--dark); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-small { padding: 8px 16px; font-size: 0.85rem; }


/* =========================================
   4. LANDING PAGE (index.php)
========================================= */
.hero-section { background: var(--dark); color: white; padding: 80px 20px; text-align: center; margin-top: -30px; margin-bottom: 40px; }
.hero-title { font-size: 3.5rem; font-weight: 900; margin-bottom: 20px; line-height: 1.1; letter-spacing: -1px; }
.hero-title span { color: var(--primary); }
.hero-subtitle { font-size: 1.2rem; color: #94a3b8; max-width: 600px; margin: 0 auto 30px auto; line-height: 1.6; }
.hero-actions { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }

.btn-outline { background: transparent; color: white; border: 2px solid white; }
.btn-outline:hover { background: white; color: var(--dark); }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-bottom: 50px; }
.feature-card { background: var(--card); padding: 30px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); text-align: center; transition: transform 0.3s ease; }
.feature-card:hover { transform: translateY(-5px); }

.icon-circle { width: 65px; height: 65px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0 auto 20px auto; }
.icon-orange { background: #ffedd5; color: var(--primary); }
.icon-blue { background: #dbeafe; color: #3b82f6; }
.icon-yellow { background: #fef9c3; color: #eab308; }

.cta-box { background: #f1f5f9; border: 2px dashed var(--border); border-radius: 12px; padding: 50px 20px; text-align: center; margin-bottom: 50px; }
.cta-box h2 { color: var(--dark); margin-top: 0; margin-bottom: 10px; }


/* =========================================
   5. UTILITIES & ALERTS
========================================= */
.passcode-box { background: #000; color: #fff; padding: 6px 10px; border-radius: 6px; font-family: monospace; font-size: 1.2rem; display: inline-block; letter-spacing: 2px; }
.data-value { font-size: 1.1rem; font-weight: 500; margin-bottom: 15px; line-height: 1.4; }

.alert { padding: 15px; border-radius: 8px; margin-bottom: 20px; font-weight: bold; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }


/* =========================================
   6. MOBILE RESPONSIVE HAMBURGER MENU
========================================= */
/* Default (Desktop): Hide hamburger */
.mobile-toggle { 
    display: none; 
    background: none; 
    border: none; 
    cursor: pointer; 
    color: var(--dark); 
    padding: 5px;
}

/* Mobile: Show hamburger, hide text nav inside dropdown */
@media (max-width: 768px) {
    .mobile-toggle { 
        display: block; /* Show hamburger */
    }
    
    .site-header { 
        position: relative; 
    }

    .main-nav { 
        display: none !important; /* Strictly hide the text nav */
        flex-direction: column; 
        width: 100%; 
        position: absolute; 
        top: 100%; /* Drop down directly below header */
        left: 0; 
        background: var(--card); 
        padding: 20px; 
        box-shadow: 0 10px 15px rgba(0,0,0,0.1); 
        z-index: 9999; 
        border-top: 1px solid var(--border); 
        box-sizing: border-box;
    }
    
    /* When Javascript adds the 'mobile-active' class, reveal the dropdown */
    .main-nav.mobile-active { 
        display: flex !important; 
    }

    .main-nav a { 
        width: 100%; 
        text-align: left; 
        padding: 12px 0; 
        border-bottom: 1px solid #eee; 
    }
    
    .main-nav a:last-child { 
        border-bottom: none; 
    }
    
    .profile-link { 
        display: inline-block; 
        padding: 10px 0; 
    }
}


/* =========================================
   7. ADMIN DATA TABLES
========================================= */
.data-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 10px; 
    font-size: 0.95rem;
}

.data-table th, .data-table td { 
    padding: 15px; 
    text-align: left; 
    border-bottom: 1px solid var(--border); 
}

.data-table th { 
    background: #f8fafc; 
    color: #64748b; 
    font-weight: bold; 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}

.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: #f1f5f9; }

.status-badge { 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 0.8rem; 
    font-weight: bold; 
}