/* ====================================
   Modern Admin Dashboard CSS
   Professional & Responsive Design
==================================== */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
    --text-muted: #64748b;
}

/* --------------------------
   Basic Reset & Typography
-------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

button, input[type="submit"] {
    font-family: inherit;
}

/* --------------------------
   Header/Navbar
-------------------------- */
.admin-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
}

.admin-header .left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-header .user-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.95rem;
}

.admin-header .user-menu a {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background 0.3s ease;
}

.admin-header .user-menu a:hover {
    background: rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

/* --------------------------
   Layout Wrapper
-------------------------- */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* --------------------------
   Sidebar
-------------------------- */
.admin-sidebar {
    width: 280px;
    background: var(--dark);
    color: white;
    padding: 2rem 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 60px);
}

.admin-sidebar ul {
    list-style: none;
}

.admin-sidebar li {
    margin: 0.25rem 0;
}

.admin-sidebar li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
    font-size: 0.95rem;
}

.admin-sidebar li a:hover {
    color: white;
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid var(--primary);
    padding-left: calc(1.5rem - 3px);
}

.admin-sidebar li a.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    border-left: 3px solid var(--primary);
    padding-left: calc(1.5rem - 3px);
}

/* --------------------------
   Main Content Area
-------------------------- */
.admin-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.admin-content h2,
.admin-content h3 {
    color: var(--dark);
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.875rem;
}

.admin-content h3 {
    font-size: 1.375rem;
}

/* --------------------------
   Footer
-------------------------- */
.admin-footer {
    background: white;
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --------------------------
   Cards & Containers
-------------------------- */
.card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}

/* --------------------------
   Dashboard Info Grid
-------------------------- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-card {
    background: white;
    padding: 1.75rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.info-card h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-card p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

/* --------------------------
   Forms
-------------------------- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="date"]:focus,
.form-group input[type="file"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* --------------------------
   Buttons
-------------------------- */
.btn,
button,
input[type="submit"] {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary,
button[type="submit"],
input[type="submit"] {
    background: var(--primary);
    color: white;
}

.btn-primary:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #7c3aed;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* --------------------------
   Tables
-------------------------- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.table thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--border);
}

.table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--dark);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table td {
    padding: 1rem;
    color: var(--dark);
    font-size: 0.95rem;
}

.table img {
    border-radius: 0.5rem;
    max-width: 60px;
    height: auto;
}

/* --------------------------
   Alerts
-------------------------- */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-color: var(--success);
}

.alert-danger {
    background: #fee2e2;
    color: #7f1d1d;
    border-color: var(--danger);
}

.alert-warning {
    background: #fef3c7;
    color: #78350f;
    border-color: var(--warning);
}

.alert-info {
    background: #cffafe;
    color: #0c4a6e;
    border-color: var(--info);
}

/* --------------------------
   Sidebar Toggle (Mobile)
-------------------------- */
.sidebar-toggle {
    display: none;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --------------------------
   Utility Classes
-------------------------- */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

/* --------------------------
   Page Layout for Forms
-------------------------- */
.page-form {
    max-width: 700px;
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.page-form-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.page-form-header h2 {
    margin: 0 0 0.5rem 0;
}

.page-form-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

/* --------------------------
   List/Index Page Layout
-------------------------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    margin: 0;
    flex: 1 1 auto;
    min-width: 200px;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.content-wrapper {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

/* --------------------------
   Badge
-------------------------- */
.badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #7f1d1d;
}

.badge-warning {
    background: #fef3c7;
    color: #78350f;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

/* --------------------------
   Responsive Design
-------------------------- */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 240px;
    }

    .info-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .admin-header {
        padding: 0.75rem 1rem;
    }

    .admin-header h1 {
        font-size: 1.375rem;
    }

    .sidebar-toggle {
        display: block;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        position: fixed;
        left: -280px;
        top: 60px;
        width: 280px;
        height: calc(100vh - 60px);
        border-right: none;
        border-bottom: none;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
        z-index: 999;
        transition: left 0.3s ease;
    }

    .admin-sidebar.open {
        left: 0;
    }

    .admin-content {
        padding: 1rem;
    }

    .admin-content h2 {
        font-size: 1.5rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .admin-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .admin-header .left {
        width: 100%;
        justify-content: center;
    }

    .admin-header h1 {
        font-size: 1.25rem;
    }

    .admin-user-menu {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }

    .info-card {
        padding: 1rem;
    }

    .info-card p {
        font-size: 1.5rem;
    }
}
