/* Dashboard stylesheet — clean, modern design without external dependencies */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-info: #0891b2;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-sidebar-bg: #1e293b;
    --color-sidebar-text: #cbd5e1;
    --color-sidebar-active: #2563eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

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

/* -- Layout ---------------------------------------------------------------- */

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

.sidebar-brand h2 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}

.sidebar-brand small {
    color: var(--color-sidebar-text);
    font-size: 0.75rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0 0.75rem;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--color-sidebar-text);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-nav li a.active {
    background: var(--color-sidebar-active);
    color: #fff;
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 0.75rem;
}

.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
}

.topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-danger);
}

.content {
    padding: 2rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
}

.page-header p {
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* -- Cards ----------------------------------------------------------------- */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* -- Metric Cards ---------------------------------------------------------- */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.metric-card .metric-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.metric-card .metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
}

.metric-card .metric-change {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.metric-change.positive { color: var(--color-success); }
.metric-change.negative { color: var(--color-danger); }

/* -- Grid Layouts ---------------------------------------------------------- */

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

/* -- Tables ---------------------------------------------------------------- */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table tr:hover {
    background: #f1f5f9;
}

/* -- Status Badges --------------------------------------------------------- */

.status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-active, .status-success { background: #dcfce7; color: #166534; }
.status-planning, .status-info { background: #dbeafe; color: #1e40af; }
.status-completed { background: #e0e7ff; color: #3730a3; }
.status-cancelled, .status-error { background: #fee2e2; color: #991b1b; }
.status-inactive, .status-on_leave { background: #fef3c7; color: #92400e; }
.status-warning { background: #fef3c7; color: #92400e; }

/* -- Notification List ----------------------------------------------------- */

.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.notification-item:last-child { border-bottom: none; }

.notification-item.unread {
    background: #f0f9ff;
    border-left: 3px solid var(--color-primary);
}

.notification-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.notification-dot.info { background: var(--color-info); }
.notification-dot.success { background: var(--color-success); }
.notification-dot.warning { background: var(--color-warning); }
.notification-dot.error { background: var(--color-danger); }

.notification-content { flex: 1; }
.notification-content h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.15rem; }
.notification-content p { font-size: 0.8rem; color: var(--color-text-muted); }
.notification-time { font-size: 0.75rem; color: var(--color-text-muted); white-space: nowrap; }

/* -- Activity Timeline ----------------------------------------------------- */

.activity-item {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-user {
    font-weight: 600;
    color: var(--color-primary);
}

.activity-time {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* -- Buttons --------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

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

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-secondary { background: #e2e8f0; color: var(--color-text); }
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

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

.btn-outline:hover { background: #f1f5f9; }

/* -- Forms ----------------------------------------------------------------- */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
}

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.15s;
    background: var(--color-surface);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-text {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 0.7rem;
    font-size: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* -- Alert Messages -------------------------------------------------------- */

.messages {
    list-style: none;
    margin-bottom: 1rem;
}

.messages li {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.messages .success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.messages .error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.messages .warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.messages .info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* -- Error list (Django form errors) --------------------------------------- */

.errorlist {
    list-style: none;
    color: var(--color-danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* -- Responsive ------------------------------------------------------------ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 1rem;
    }
}
