@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand Colors - Karting/Speed Theme - UPDATED TO GREYSCALE */
    --primary-color: #757575;       /* Grey 600 */
    --primary-hover: #616161;       /* Grey 700 */
    --primary-light: #F5F5F5;       /* Grey 100 */
    
    --secondary-color: #64748b;     /* Slate 500 */
    --secondary-hover: #475569;     /* Slate 600 */
    
    --accent-color: #9e9e9e;        /* Grey 500 - replacing Amber */
    
    --success-color: #10b981;       /* Emerald */
    --danger-color: #ef4444;        /* Red */
    --info-color: #3b82f6;          /* Blue */
    
    /* Backgrounds */
    --bg-body: #f8fafc;             /* Slate 50 */
    --bg-card: #ffffff;
    --bg-sidebar: #1C1C1C;          /* Very Dark Gray/Black */
    
    /* Text */
    --text-main: #1e293b;           /* Slate 800 */
    --text-muted: #64748b;          /* Slate 500 */
    --text-light: #f1f5f9;          /* Slate 100 */
    
    /* Borders & Shadows */
    --border-color: #e2e8f0;        /* Slate 200 */
    --border-focus: #4f46e5;
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-soft: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    
    /* Layout */
    --sidebar-width: 280px;
    --header-height: 70px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

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

ul {
    list-style: none;
}

button, input, select, textarea {
    font-family: inherit;
}

/* Layout Types */
body.centered-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    position: relative;
    overflow: hidden;
}

/* Background decoration for auth pages */
body.centered-layout::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
    z-index: 0;
}

body.centered-layout::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(158, 158, 158, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    bottom: -50px;
    left: -50px;
    border-radius: 50%;
    z-index: 0;
}

body.dashboard-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-body);
}

/* Containers */
.auth-container {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.6);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

.container {
    width: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.sidebar h3 {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar h3 i {
    margin-right: 0.75rem;
    color: var(--accent-color);
}

.sidebar-nav {
    padding: 1.5rem 1rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: rgba(255,255,255,0.7);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav a i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
    text-align: center;
    transition: var(--transition);
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--primary-color);
    color: #fff;
    transform: translateX(5px);
}

.sidebar-nav a.active i {
    transform: scale(1.1);
}

.sidebar-nav a:last-child {
    margin-top: auto;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    margin-top: 2rem;
}

.sidebar-nav a:last-child:hover {
    background: var(--danger-color);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: var(--transition);
    width: calc(100% - var(--sidebar-width));
}

.nav-header {
    background: var(--bg-card);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    height: 80px;
}

.nav-header h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin: 0;
    font-weight: 700;
}

.nav-header div {
    font-weight: 500;
    color: var(--text-muted);
}

.nav-header b {
    color: var(--primary-color);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    font-weight: 700;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem; /* Space for icon */
    background: var(--bg-body);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: var(--transition);
    color: var(--text-main);
}

/* Add padding fallback for inputs without icons if needed, 
   but specific pages have incline styles for padding-left: 35px. 
   We will override that slightly here by forcing it or respecting it. */

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    background: #fff;
}

/* Styling icons inside inputs relying on FontAwesome absolute positioning in existing HTML */
.form-group i {
    z-index: 2;
    color: var(--text-muted) !important;
    transition: var(--transition);
}

input:focus + i, input:focus ~ i {
    color: var(--primary-color) !important;
}

/* Buttons */
.btn, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    gap: 8px;
    text-decoration: none; /* Ensure links acting as buttons don't have underline */
}

a.btn:hover {
    text-decoration: none;
}

button:active, .btn:active {
    transform: scale(0.98);
}

.btn-primary, button[type="submit"] {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
}

.btn-primary:hover, button[type="submit"]:hover {
    filter: brightness(110%);
    color: white;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-warning {
    background: var(--accent-color);
    color: white;
}

.btn-warning:hover {
    filter: brightness(90%);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    filter: brightness(95%);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
    text-transform: none;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    text-align: left;
}

thead {
    background: #f1f5f9;
    border-bottom: 2px solid var(--border-color);
}

th {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

tr:hover td {
    background: #fafafa;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert a {
    color: inherit;
    text-decoration: underline;
    margin-left: 5px;
}

/* Responsive */
.mobile-header {
    display: none;
    background: var(--bg-sidebar);
    color: white;
    padding: 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 99;
}

.mobile-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.mobile-header button {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
}

.sidebar-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 90;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    .mobile-header {
        display: flex;
    }
    
    .nav-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        height: auto;
        padding: 1.5rem;
    }
    
    .auth-container {
        padding: 2rem;
        max-width: 100%;
    }
}
