:root {
    --primary-color: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary-color: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-main: #f1f5f9;
    --white: #ffffff;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 800;
}

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

.nav-links a:not(.btn) {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:not(.btn):hover, .nav-links a:not(.btn).active {
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white !important;
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(14, 165, 233, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* Main Content */
main {
    flex: 1;
    padding: 40px 0;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

/* Input Fields */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: var(--secondary-color);
    text-align: left;
    padding: 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

table tr:hover td {
    background: #f8fafc;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-info { background: #eff6ff; color: #1d4ed8; border-left: 4px solid #3b82f6; }
.alert-success { background: #f0fdf4; color: #15803d; border-left: 4px solid #22c55e; }
.alert-danger { background: #fef2f2; color: #b91c1c; border-left: 4px solid #ef4444; }

/* Grid */
.grid {
    display: grid;
    gap: 20px;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Footer */
footer {
    background: var(--white);
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .grid-cols-2, .grid-cols-4 { grid-template-columns: 1fr; }
    
    .navbar {
        height: auto;
        flex-direction: column;
        padding: 15px 0;
        gap: 15px;
    }
    
    .nav-links { 
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px 15px;
    }
    
    .table-responsive { 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius);
    }
    
    .auth-card, .card {
        padding: 20px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }

    /* Admin Mobile Overrides */
    .admin-layout {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100% !important;
        display: flex;
        overflow-x: auto;
        padding: 0 !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
    }
    .admin-sidebar a {
        display: inline-block !important;
        white-space: nowrap;
        padding: 12px 15px !important;
        border-left: none !important;
        border-bottom: 3px solid transparent;
    }
    .admin-sidebar a.active {
        border-bottom: 3px solid var(--primary-color) !important;
        background: transparent !important;
    }
    .admin-content {
        padding: 20px 15px !important;
    }

    /* Convert Tables to Cards on Mobile */
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        margin-bottom: 20px;
        background: var(--white);
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        overflow: hidden;
    }
    td {
        border: none;
        border-bottom: 1px solid #f1f5f9;
        position: relative;
        padding: 12px 15px 12px 40% !important;
        text-align: right !important;
        min-height: 50px;
    }
    td:last-child {
        border-bottom: none;
        background: #f8fafc;
    }
    td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        top: 12px;
        width: 35%;
        text-align: left;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-muted);
        white-space: nowrap;
    }
    
    /* Realign elements within card cells */
    td > div {
        text-align: right !important;
    }
}

/* Auth Pages Specific */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 160px);
}

.auth-card {
    width: 100%;
    max-width: 450px;
}
