/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #3b82f6; 
    --primary-hover: #2563eb;
    --bg-color: #f3f4f6;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f8fafc;
    --sidebar-hover: #334155;
    --text-color: #334155;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Auth Layout */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background-color: var(--bg-color);
}

.auth-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--primary-color);
}
.auth-card p.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}
.alert-error {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.alert-success {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}


/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.375rem;
    transition: color .15s, background-color .15s, border-color .15s, box-shadow .15s;
    cursor: pointer;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    width: 100%;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.2rem;
    width: auto;
}
.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
}
.btn-outline:hover {
    background-color: var(--bg-color);
}

/* Dashboard Layout */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: bold;
    color: #fff;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    letter-spacing: 1px;
}

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

.sidebar-nav li {
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.7);
    border-radius: 0.375rem;
    transition: all 0.2s;
}

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

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer .user-info {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: rgba(255,255,255,0.8);
    word-break: break-all;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
    width: calc(100% - 250px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Cards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Tables */
.card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    overflow: hidden;
}

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

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

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, .table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

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

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 9999px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* Pagination */
.pagination {
    display: flex;
    list-style: none;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
    gap: 0.25rem;
}

.pagination a, .pagination span {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-color);
}

.pagination a:hover {
    background-color: var(--bg-color);
}
.pagination span.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Detail View */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}
@media (max-width: 992px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}
.detail-row:last-child {
    border-bottom: none;
}
.detail-label {
    width: 35%;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.detail-value {
    width: 65%;
    font-size: 0.875rem;
    word-break: break-all;
}

/* Notes Section */
.note-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.note-item:last-child {
    border-bottom: none;
}
.note-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.note-text {
    font-size: 0.875rem;
}
