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

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4CAF50;
    --dark-bg: #1a1a2e;
    --sidebar-bg: #16213e;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: white;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.logo i {
    font-size: 32px;
    color: var(--primary-color);
}

.logo h2 {
    font-size: 24px;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 10px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-menu li.active a {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.nav-menu i {
    font-size: 18px;
    width: 20px;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px 40px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.header h1 {
    font-size: 32px;
    color: var(--text-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

.user-info i {
    font-size: 32px;
    color: var(--primary-color);
}

/* ===== Auth Section ===== */
.auth-card {
    background: white;
    border-radius: 20px;
    padding: 2rem 2.25rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

/* ── Logo ── */
.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-logo .logo-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .75rem;
}
.auth-logo .logo-icon i { font-size: 1.5rem; color: white; }
.auth-logo h1 { font-size: 1.4rem; color: #1f2937; margin: 0 0 .2rem; font-weight: 700; }
.auth-logo p  { color: #6b7280; font-size: .85rem; margin: 0; }

/* ── Form fields ── */
.field {
    margin-bottom: .85rem;
}
.field label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .3rem;
}
.field .input-wrap {
    position: relative;
}
.field .input-wrap i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: .85rem;
}
.field input,
.field select {
    width: 100%;
    padding: .6rem .75rem .6rem 2.25rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    font-size: .875rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s;
    background: white;
    color: #1f2937;
    appearance: none;
}
.field input:focus,
.field select:focus { border-color: #667eea; }
.field .hint { font-size: .75rem; color: #9ca3af; margin-top: .2rem; }

/* ── Two-column row ── */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-bottom: .85rem;
}
.field-row .field { margin-bottom: 0; }

/* ── Role selector cards ── */
.role-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .6rem;
    margin-bottom: .85rem;
}
.role-option {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: .75rem .875rem;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.role-option:hover { border-color: #667eea; background: #f5f3ff; }
.role-option.selected { border-color: #667eea; background: #f5f3ff; }
.role-option .role-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem; flex-shrink: 0;
}
.role-option.user-opt .role-icon  { background: #dbeafe; color: #1d4ed8; }
.role-option.guru-opt .role-icon  { background: #ede9fe; color: #7c3aed; }
.role-option .role-text strong { display: block; font-size: .8rem; font-weight: 700; color: #1f2937; }
.role-option .role-text span   { font-size: .72rem; color: #6b7280; }
/* Hidden real select */
#role { display: none; }

/* ── Button ── */
.btn-auth {
    width: 100%;
    padding: .75rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
    margin-top: .25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}
.btn-auth:hover { opacity: .9; }
.btn-auth:disabled { opacity: .6; cursor: not-allowed; }

/* ── Footer ── */
.auth-footer {
    text-align: center;
    margin-top: 1.1rem;
    font-size: .85rem;
    color: #6b7280;
}
.auth-footer a { color: #667eea; font-weight: 600; text-decoration: none; }

/* ── Message ── */
.msg {
    border-radius: 8px;
    padding: .65rem .875rem;
    font-size: .85rem;
    margin-bottom: .875rem;
    display: none;
}
.msg.show   { display: block; }
.msg.error  { background: #fee2e2; color: #dc2626; }
.msg.success{ background: #d1fae5; color: #065f46; }

/* ── Divider ── */
.field-label-row {
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .4rem;
}

/* ===== Welcome Section ===== */
.welcome-section {
    margin-bottom: 30px;
}

.welcome-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.welcome-card h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.welcome-card p {
    font-size: 16px;
    margin-bottom: 20px;
    opacity: 0.9;
}

/* ===== Buttons ===== */
.btn-primary, .btn-secondary, .btn-danger, .btn-control {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

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

.btn-secondary:hover {
    background: #1976D2;
}

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

.btn-danger:hover {
    background: #da190b;
}

/* ===== Statistics Cards ===== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-icon.good {
    background: var(--success-color);
}

.stat-icon.bad {
    background: var(--danger-color);
}

.stat-icon.time {
    background: var(--secondary-color);
}

.stat-icon.alerts {
    background: var(--warning-color);
}

.stat-info h3 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Info Section ===== */
.info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.info-card h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card ul {
    list-style: none;
    padding-left: 0;
}

.info-card li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card li:before {
    content: "✓";
    color: var(--primary-color);
    font-weight: bold;
}

/* ===== Activity Section ===== */
.activity-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.activity-section h2 {
    margin-bottom: 20px;
}

.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-bottom: 10px;
}

.modal-content p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.input-field {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== Video Section ===== */
.video-section {
    margin-bottom: 30px;
}

.video-container {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
}

.video-feed {
    width: 100%;
    height: auto;
    display: block;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.video-overlay i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.video-overlay.hidden {
    display: none;
}

/* ===== Calibration Overlay ===== */
.calibration-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.calibration-overlay.hidden {
    display: none;
}

.calibration-content {
    text-align: center;
    color: white;
    padding: 40px;
    max-width: 600px;
}

.countdown-container {
    margin-bottom: 30px;
}

.countdown-text {
    font-size: 24px;
    margin-bottom: 30px;
    font-weight: 600;
}

.countdown-number {
    font-size: 120px;
    font-weight: bold;
    color: var(--primary-color);
    animation: pulse 1s ease-in-out;
    text-shadow: 0 0 30px rgba(76, 175, 80, 0.5);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.calibration-result {
    margin-top: 30px;
}

.calibration-success,
.calibration-error {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

.calibration-success h3 {
    color: var(--success-color);
    margin-bottom: 20px;
    font-size: 28px;
}

.calibration-values {
    margin: 20px 0;
    text-align: left;
}

.calib-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.calib-value .label {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.calib-value .value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.info-text {
    margin: 20px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.6;
}

.calibration-error {
    color: var(--danger-color);
}

.calibration-result .btn-primary {
    margin-top: 20px;
    padding: 12px 40px;
    font-size: 16px;
}


/* ===== Controls ===== */
.controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.btn-control {
    flex: 1;
    max-width: 200px;
}

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

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

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

.btn-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Status Panel ===== */
.status-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

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

.status-card h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--text-secondary);
}

.posture-status {
    text-align: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
}

.status-badge.good {
    background: var(--success-color);
    color: white;
}

.status-badge.bad {
    background: var(--danger-color);
    color: white;
}

.status-badge.unknown {
    background: var(--text-secondary);
    color: white;
}

/* ===== Angle Display ===== */
.angle-display {
    text-align: center;
}

.angle-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.angle-bar {
    width: 100%;
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.angle-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s, background 0.3s;
}

.angle-fill.warning {
    background: var(--warning-color);
}

.angle-fill.danger {
    background: var(--danger-color);
}

/* ===== Timer ===== */
.timer-display {
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
}

.timer-display i {
    margin-right: 10px;
}

/* ===== Live Stats ===== */
.live-stats {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.live-stats h2 {
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.mini-stat i {
    font-size: 32px;
    color: var(--primary-color);
}

.mini-stat h4 {
    font-size: 24px;
    margin-bottom: 5px;
}

.mini-stat p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Monitoring Status ===== */
.monitoring-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 2s infinite;
}

.status-indicator.active {
    background: var(--success-color);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== Filter Tabs ===== */
.filter-tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ===== Summary Section ===== */
.summary-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.summary-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.summary-content h3 {
    font-size: 32px;
    margin-bottom: 5px;
}

.trend {
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
}

.trend.up {
    color: var(--success-color);
    background: rgba(76, 175, 80, 0.1);
}

.trend.down {
    color: var(--danger-color);
    background: rgba(244, 67, 54, 0.1);
}

/* ===== Charts ===== */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    margin-bottom: 20px;
}

.chart-placeholder {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== History Table ===== */
.history-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.history-section h2 {
    margin-bottom: 20px;
}

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

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

.history-table th,
.history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: var(--text-primary);
}

.history-table tbody tr:hover {
    background: #f9f9f9;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.setting-label {
    flex: 1;
}

.setting-label span {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.setting-description {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Switch Toggle ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* ===== Form Inputs ===== */
.input-number,
.select-field {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    min-width: 150px;
}

.range-slider {
    width: 200px;
    margin-right: 10px;
}

.range-value {
    font-weight: 600;
    color: var(--primary-color);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
        padding: 15px;
    }
    
    .stats-section,
    .summary-section {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 60px;
        padding: 10px;
    }
    
    .sidebar .logo h2,
    .sidebar .nav-menu span {
        display: none;
    }
    
    .main-content {
        margin-left: 60px;
        padding: 10px;
    }
}

/* ===== Sidebar Footer (user info + logout) ===== */
.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.5rem 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info-sidebar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.user-info-sidebar i {
    font-size: 1.25rem;
    flex-shrink: 0;
    color: rgba(255,255,255,0.6);
}

#sidebarUsername {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: background 0.2s, color 0.2s;
}

.btn-logout:hover {
    background: rgba(239,68,68,0.2);
    color: #fca5a5;
}

.btn-logout i {
    font-size: 1rem;
}

/* Sidebar flex column agar footer selalu di bawah */
.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar .nav-menu {
    flex: 1;
}

/* ===== Dashboard Welcome & Mode Cards ===== */
.welcome-section {
    margin-bottom: 0;
}

/* Override welcome-card lama jika ada */
.welcome-section .welcome-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 14px;
    padding: 1.75rem 2rem;
    color: white;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px rgba(102,126,234,.3);
}

.welcome-section .welcome-card h2 {
    font-size: 1.5rem;
    margin: 0 0 .4rem;
    color: white;
}

.welcome-section .welcome-card p {
    opacity: .85;
    margin: 0;
    font-size: .95rem;
    color: white;
}


/* ═══════════════════════════════════════════════════════════════════════════
   SHARED TEACHER UI COMPONENTS
   Digunakan oleh: teacher_dashboard, teacher_classes, teacher_class_detail,
                   teacher_student_history, teacher_history, settings
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tombol utama (gradient ungu) ── */
.btn-ps-primary {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    padding: .55rem 1.1rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .2s;
    text-decoration: none;
}
.btn-ps-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-ps-primary i { color: inherit; }

/* ── Tombol sekunder (abu-abu) ── */
.btn-ps-secondary {
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 9px;
    padding: .55rem 1.1rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.btn-ps-secondary:hover { background: #e5e7eb; }

/* ── Tombol aksi kecil (dalam tabel) ── */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    border: none;
    border-radius: 7px;
    padding: .35rem .7rem;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-action.blue   { background: #dbeafe; color: #1d4ed8; }
.btn-action.blue:hover { background: #bfdbfe; }
.btn-action.indigo { background: #e0e7ff; color: #3730a3; }
.btn-action.indigo:hover { background: #c7d2fe; }
.btn-action.danger { background: #fee2e2; color: #991b1b; }
.btn-action.danger:hover { background: #fecaca; }
.btn-action i { color: inherit; }

/* ── Tombol ekspor PDF (merah) ── */
.btn-export-pdf {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 10px;
    padding: .55rem 1.1rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}
.btn-export-pdf:hover { opacity: .85; }
.btn-export-pdf:disabled { opacity: .5; cursor: not-allowed; }
.btn-export-pdf i { color: inherit; }

/* ── Section Card ── */
.section-card {
    background: white;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.section-card-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1.25rem;
}
.section-card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}
.section-card-header > i {
    color: #667eea;
    font-size: 1rem;
}
/* Ikon di dalam tombol tidak ikut warna biru */
.section-card-header .btn-ps-primary i,
.section-card-header .btn-action i,
.section-card-header .btn-export-pdf i,
.section-card-header a i { color: inherit; }

/* ── Tabel guru ── */
.teacher-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.teacher-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    padding: .75rem 1rem;
    text-align: left;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}
.teacher-table td {
    padding: .75rem 1rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.teacher-table tbody tr:last-child td { border-bottom: none; }
.teacher-table tbody tr:hover td { background: #f9fafb; }
.teacher-table a { color: #667eea; text-decoration: none; font-weight: 500; }
.teacher-table a:hover { text-decoration: underline; }

/* ── Loading / Empty state ── */
.loading-row td, .empty-row td {
    text-align: center;
    color: #9ca3af;
    padding: 2rem 1rem;
    font-size: .875rem;
}
.loading-row td i, .empty-row td i {
    display: block;
    font-size: 1.75rem;
    margin-bottom: .5rem;
    opacity: .5;
}

/* ── Score badge ── */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
}
.score-badge.good   { background: #d1fae5; color: #065f46; }
.score-badge.medium { background: #fef3c7; color: #92400e; }
.score-badge.warn   { background: #fef3c7; color: #92400e; }
.score-badge.bad    { background: #fee2e2; color: #991b1b; }
.score-badge.none   { background: #f3f4f6; color: #9ca3af; }

/* ── FHP badge ── */
.fhp-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}
.fhp-badge.yes { background: #fee2e2; color: #991b1b; }
.fhp-badge.no  { background: #d1fae5; color: #065f46; }
.fhp-yes { color: #ef4444; font-weight: 600; font-size: .8rem; }
.fhp-no  { color: #10b981; font-weight: 600; font-size: .8rem; }

/* ── Date / angle text ── */
.date-text  { font-size: .8rem; color: #6b7280; white-space: nowrap; }
.angle-text { font-size: .875rem; color: #374151; font-variant-numeric: tabular-nums; }

/* ── Action group ── */
.action-group { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Count badge (jumlah murid) ── */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
    background: #ede9fe;
    color: #5b21b6;
}

/* ── Back link ── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .875rem;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1rem;
}
.back-link:hover { text-decoration: underline; }

/* ── Toast notification ── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #1f2937;
    color: white;
    padding: .75rem 1.25rem;
    border-radius: 10px;
    font-size: .875rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    z-index: 2000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .25s, transform .25s;
    max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }

/* ── Modal overlay ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal-box {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    position: relative;
}
.modal-box h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1.5rem;
}
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: .25rem;
    border-radius: 6px;
    transition: color .15s, background .15s;
}
.modal-close:hover { color: #374151; background: #f3f4f6; }

/* ── Form group ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .4rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    padding: .6rem .85rem;
    font-size: .875rem;
    color: #1f2937;
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
    font-family: inherit;
    background: white;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: #667eea; }
.form-group textarea { resize: vertical; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1.5rem;
}

/* ── Period filter tabs ── */
.tab-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: .45rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.tab-btn:hover { background: #e5e7eb; }
.tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
}

/* ── Settings card  ── */
.settings-card {
    background: white;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}
.settings-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.settings-card h3 i { color: #667eea; font-size: 1rem; }

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .875rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.setting-item:last-child { border-bottom: none; }

.setting-label { flex: 1; }
.setting-label span {
    display: block;
    font-weight: 600;
    font-size: .875rem;
    color: #1f2937;
    margin-bottom: .2rem;
}
.setting-description { font-size: .8rem; color: #6b7280; }

.settings-actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* ── About section ── */
.about-section {
    background: white;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid #e5e7eb;
    margin-top: 1.5rem;
}
.about-section h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1rem;
}
.about-card p {
    font-size: .875rem;
    color: #374151;
    margin-bottom: .5rem;
    line-height: 1.7;
}

/* ── Settings section wrapper ── */
.settings-section { /* full width, no max-width */ }

/* ── Input number & range (settings) ── */
.input-number, .select-field {
    padding: .5rem .75rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: .875rem;
    min-width: 120px;
    outline: none;
    transition: border-color .15s;
}
.input-number:focus, .select-field:focus { border-color: #667eea; }

.range-slider { width: 180px; margin-right: .5rem; accent-color: #667eea; }
.range-value  { font-weight: 700; color: #667eea; font-size: .875rem; }
