/**
 * SOBAT NAMI - Main Stylesheet
 * SMA An-Namiroh Pekanbaru
 * Tema: Hijau Emerald + Amber Gold + Modern Classic
 */

/* ===== ROOT VARIABLES ===== */
:root {
    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-200: #a7f3d0;
    --emerald-300: #6ee7b7;
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065f46;
    --emerald-900: #064e3b;

    --amber-50: #fffbeb;
    --amber-100: #fef3c7;
    --amber-200: #fde68a;
    --amber-300: #fcd34d;
    --amber-400: #fbbf24;
    --amber-500: #f59e0b;
    --amber-600: #d97706;
    --amber-700: #b45309;
    --amber-800: #92400e;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    width: 100%;
    padding: 0 20px;
}

/* ===== LOGIN PAGE ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('assets/bg-sekolah-hd.jpg?v=final');
    background-size: cover;
    /* Cover untuk memenuhi layar dengan proposi yang tepat */
    background-position: center;
    /* Tetap di tengah */
    background-repeat: no-repeat;
    /* Tidak berulang */
    background-attachment: fixed;
    /* Fixed saat scroll */
    image-rendering: -webkit-optimize-contrast;
    /* Rendering yang lebih tajam di Chrome/Safari */
    image-rendering: crisp-edges;
    /* Rendering tajam untuk edge yang jelas */
    image-rendering: high-quality;
    /* Quality tinggi untuk Firefox */
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--emerald-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.login-logo svg {
    width: 40px;
    height: 40px;
    color: var(--emerald-600);
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--emerald-800);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--gray-600);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--emerald-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--emerald-600);
    color: white;
    width: 100%;
    padding: 14px;
}

.btn-primary:hover {
    background: var(--emerald-700);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.login-info {
    margin-top: 20px;
    padding: 15px;
    background: var(--amber-50);
    border: 1px solid var(--amber-200);
    border-radius: 10px;
    text-align: center;
}

.login-info p {
    font-size: 12px;
    color: var(--amber-800);
    margin: 0;
    text-align: center;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: linear-gradient(180deg, var(--emerald-800) 0%, var(--emerald-900) 100%);
    color: white;
    padding: 24px;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar.closed {
    transform: translateX(-100%);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 50px;
    height: 50px;
    background: var(--amber-400);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo svg {
    width: 28px;
    height: 28px;
    color: var(--emerald-900);
}

.sidebar-brand h2 {
    font-size: 20px;
    font-weight: 700;
}

.sidebar-brand p {
    font-size: 11px;
    color: var(--emerald-200);
}

.sidebar-user {
    background: var(--emerald-700);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.sidebar-user h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-user p {
    font-size: 12px;
    color: var(--emerald-200);
}

.sidebar-user .user-role {
    display: inline-block;
    background: var(--amber-400);
    color: var(--emerald-900);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
    text-transform: uppercase;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: white;
    transition: all 0.3s ease;
}

.sidebar-menu a:hover {
    background: var(--emerald-700);
}

.sidebar-menu a.active {
    background: var(--amber-400);
    color: var(--emerald-900);
    font-weight: 600;
}

.sidebar-menu svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    background: rgba(239, 68, 68, 0.2);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-logout:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 70px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 999;
    box-shadow: var(--shadow-sm);
}

.header.full-width {
    left: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-toggle-sidebar {
    background: var(--gray-100);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-toggle-sidebar:hover {
    background: var(--gray-200);
}

.header-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--emerald-800);
}

.header-title p {
    font-size: 13px;
    color: var(--gray-600);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-clock {
    text-align: right;
}

.clock-time {
    font-size: 18px;
    font-weight: 700;
    color: var(--emerald-700);
    font-family: 'Courier New', monospace;
}

.clock-date {
    font-size: 12px;
    color: var(--gray-600);
}

.notification-bell {
    position: relative;
    background: var(--gray-100);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-bell:hover {
    background: var(--emerald-100);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 280px;
    margin-top: 70px;
    padding: 24px;
    min-height: calc(100vh - 70px);
    transition: margin-left 0.3s ease;
}

.main-content.full-width {
    margin-left: 0;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.card-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-100);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
}

.card-subtitle {
    font-size: 14px;
    color: var(--gray-600);
    margin-top: 4px;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 2px solid var(--gray-200);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card.emerald {
    border-color: var(--emerald-200);
    background: linear-gradient(135deg, var(--emerald-50) 0%, white 100%);
}

.stat-card.amber {
    border-color: var(--amber-200);
    background: linear-gradient(135deg, var(--amber-50) 0%, white 100%);
}

.stat-card.blue {
    border-color: #bfdbfe;
    background: linear-gradient(135deg, #dbeafe 0%, white 100%);
}

.stat-card.red {
    border-color: #fecaca;
    background: linear-gradient(135deg, #fee2e2 0%, white 100%);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card.emerald .stat-icon {
    background: var(--emerald-100);
    color: var(--emerald-700);
}

.stat-card.amber .stat-icon {
    background: var(--amber-100);
    color: var(--amber-700);
}

.stat-card.blue .stat-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.stat-card.red .stat-icon {
    background: #fee2e2;
    color: #dc2626;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
}

.stat-label {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 600;
}

/* ===== TABLES ===== */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--gray-50);
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}

table tbody tr:hover {
    background: var(--gray-50);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: var(--emerald-100);
    color: var(--emerald-700);
}

.badge-warning {
    background: var(--amber-100);
    color: var(--amber-700);
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* ===== ALERTS ===== */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: start;
    gap: 12px;
}

.alert-success {
    background: var(--emerald-50);
    border: 1px solid var(--emerald-200);
    color: var(--emerald-800);
}

.alert-warning {
    background: var(--amber-50);
    border: 1px solid var(--amber-200);
    color: var(--amber-800);
}

.alert-danger {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* ===== BUTTONS ===== */
.btn-secondary {
    background: var(--gray-600);
    color: white;
}

.btn-secondary:hover {
    background: var(--gray-700);
}

.btn-success {
    background: var(--emerald-600);
    color: white;
}

.btn-success:hover {
    background: var(--emerald-700);
}

.btn-warning {
    background: var(--amber-500);
    color: white;
}

.btn-warning:hover {
    background: var(--amber-600);
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile Small (320px - 480px) */
@media (max-width: 480px) {
    .login-container {
        padding: 24px 16px;
        max-width: 100%;
        margin: 16px;
    }

    .login-title {
        font-size: 22px;
    }

    .login-logo {
        width: 60px;
        height: 60px;
    }

    .card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .card-title {
        font-size: 18px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 28px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 13px;
        width: 100%;
    }

    .form-control {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    .header-title h1 {
        font-size: 16px;
    }

    .header-title p {
        font-size: 11px;
    }

    .clock-time {
        font-size: 14px;
    }

    .clock-date {
        font-size: 10px;
    }
}

/* Mobile & Tablet (max-width: 768px) */
@media (max-width: 768px) {

    /* Sidebar Hidden by Default */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
        z-index: 1001;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Header Full Width */
    .header {
        left: 0;
        padding: 0 12px;
        height: 60px;
    }

    .header-left {
        gap: 8px;
    }

    .btn-toggle-sidebar {
        display: flex;
    }

    .header-title h1 {
        font-size: 18px;
    }

    .header-right {
        gap: 12px;
    }

    .header-clock {
        display: none;
        /* Hide clock on mobile to save space */
    }

    /* Main Content Full Width */
    .main-content {
        margin-left: 0;
        margin-top: 60px;
        padding: 16px;
    }

    /* Stats Grid - 1 Column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Login Container */
    .login-container {
        padding: 30px 20px;
        max-width: 100%;
        margin: 12px;
    }

    /* Forms */
    .form-group {
        margin-bottom: 16px;
    }

    .form-control {
        padding: 14px 16px;
        font-size: 16px;
        /* Prevent iOS zoom */
        min-height: 48px;
        /* Touch friendly */
    }

    /* Buttons */
    .btn {
        min-height: 48px;
        /* Touch friendly */
        width: 100%;
        margin-bottom: 8px;
    }

    .btn-sm {
        min-height: 44px;
        padding: 10px 14px;
    }

    /* Tables Responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }

    table {
        min-width: 600px;
        font-size: 13px;
    }

    table th,
    table td {
        padding: 10px 12px;
        white-space: nowrap;
    }

    /* Cards */
    .card {
        padding: 20px;
        margin-bottom: 16px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Alerts */
    .alert {
        padding: 12px 16px;
        font-size: 13px;
    }

    /* Stat Cards */
    .stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 32px;
    }

    .stat-label {
        font-size: 13px;
    }

    /* Notification Bell */
    .notification-bell {
        width: 36px;
        height: 36px;
    }

    /* Utility Classes for Mobile */
    .hide-mobile {
        display: none !important;
    }
}

/* Tablet Portrait (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .login-container {
        max-width: 480px;
        margin: 24px auto;
        padding: 40px 30px;
    }

    .card {
        padding: 24px;
    }

    table {
        font-size: 14px;
    }
}

/* Tablet Landscape (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .header {
        left: 240px;
    }

    .main-content {
        margin-left: 240px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .container-fluid {
        padding: 0 16px;
    }
}

/* Desktop Small (1025px - 1280px) */
@media (min-width: 1025px) and (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape Orientation Fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .login-wrapper {
        padding: 12px;
    }

    .login-container {
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .login-logo {
        width: 50px;
        height: 50px;
    }

    .sidebar {
        overflow-y: auto;
    }

    .header {
        height: 50px;
    }

    .main-content {
        margin-top: 50px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch targets */
    .btn {
        min-height: 48px;
        padding: 14px 20px;
    }

    .sidebar-menu a {
        padding: 14px 16px;
        min-height: 48px;
    }

    /* Remove hover effects on touch */
    .btn:hover {
        transform: none;
    }

    .stat-card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }

    /* Better tap highlighting */
    button,
    a,
    input,
    select {
        -webkit-tap-highlight-color: rgba(16, 185, 129, 0.2);
    }
}

/* ===== UTILITIES ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 16px;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}