/* ProTime — улбар шар брэнд өнгөтэй интерфэйс */

:root {
    --brand: #F97316;
    --brand-dark: #C2410C;
    --brand-light: #FED7AA;
    --brand-50: #FFF7ED;

    --sidebar-bg: #1E293B;
    --sidebar-bg-hover: #334155;
    --sidebar-text: #CBD5E1;
    --sidebar-text-active: #FFFFFF;

    --topbar-bg: #FFFFFF;
    --topbar-border: #E5E7EB;

    --body-bg: #F3F4F6;
    --card-bg: #FFFFFF;
    --text: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;

    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.05);

    --sidebar-width: 240px;
    --topbar-height: 60px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--body-bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ===== Layout ===== */
.app {
    display: flex;
    min-height: 100vh;
}

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

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.sidebar-brand .name {
    color: white;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: .3px;
}

.sidebar-section {
    padding: 16px 20px 8px;
    font-size: 11px;
    text-transform: uppercase;
    color: #64748B;
    letter-spacing: .8px;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0 8px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--sidebar-text);
    border-radius: 8px;
    margin-bottom: 2px;
    font-size: 14px;
    transition: background .15s, color .15s;
}

.sidebar-menu li a:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-active);
}

.sidebar-menu li a.active {
    background: var(--brand);
    color: white;
    box-shadow: 0 4px 12px rgba(249,115,22,.35);
}

.sidebar-menu li a i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid #334155;
    font-size: 12px;
    color: #64748B;
}

/* ===== Main area ===== */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Topbar ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

.topbar-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.topbar-search input {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #F9FAFB;
    font-size: 14px;
    outline: none;
}

.topbar-search input:focus {
    border-color: var(--brand);
    background: white;
    box-shadow: 0 0 0 3px var(--brand-light);
}

.topbar-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-icon {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s;
}

.topbar-icon:hover {
    background: var(--brand-50);
    color: var(--brand);
}

.topbar-icon i { font-size: 20px; }

.topbar-icon .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--brand);
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 8px;
    cursor: pointer;
    margin-left: 8px;
}

.topbar-user:hover { background: #F3F4F6; }

.topbar-user .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.topbar-user .name {
    font-weight: 500;
    font-size: 13px;
}

.topbar-user .role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== Page content ===== */
.page {
    padding: 24px;
    flex: 1;
}

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

.page-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.breadcrumb a { color: var(--text-muted); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--brand);
    color: white;
}
.btn-primary:hover {
    background: var(--brand-dark);
    color: white;
}

.btn-outline {
    border-color: var(--border);
    color: var(--text);
    background: white;
}
.btn-outline:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== Cards / Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.stat-card .stat-icon {
    float: right;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--brand-50);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-card .stat-trend {
    font-size: 12px;
    margin-top: 8px;
    color: var(--text-muted);
}

.stat-card .stat-trend.up { color: var(--success); }
.stat-card .stat-trend.down { color: var(--danger); }

.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.card-body { padding: 20px; }

/* ===== Tables ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 12px 20px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: #F9FAFB;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    letter-spacing: .3px;
}

.table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.table tbody tr:hover { background: var(--brand-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-neutral { background: #F3F4F6; color: #4B5563; }
.badge-brand { background: var(--brand-light); color: var(--brand-dark); }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
}

/* ===== Login ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand) 0%, #FB923C 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 16px;
    padding: 36px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
}

.login-card .logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--brand);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto 16px;
}

.login-card h1 {
    text-align: center;
    font-size: 22px;
    margin: 0 0 6px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 13px;
}

.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; }

.login-error {
    background: #FEE2E2;
    color: #991B1B;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ===== Dropdown ===== */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 280px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    border: 1px solid var(--border);
    padding: 8px 0;
    display: none;
    z-index: 100;
}
.dropdown.open .dropdown-menu { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}
.dropdown-item:hover { background: var(--brand-50); color: var(--brand); }

.dropdown-header {
    padding: 12px 16px 8px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar-search { display: none; }
}
