/* ============================================
   Susu Sekolah - Design System
   Modern, Clean, Professional
   ============================================ */

/* === Reset & Base === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;

    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;

    --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;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.2s ease;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* === Layout === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Header === */
.main-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 0;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.logo-sub {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 400;
}

.header-nav {
    display: flex;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.nav-link.active {
    background: var(--primary-50);
    color: var(--primary);
}

/* === Main Content === */
.main-content {
    flex: 1;
    padding: 32px 0;
}

.page-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 28px;
    align-items: start;
}

/* === Cards === */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 20px 24px 0;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.card-title svg {
    color: var(--primary);
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 4px;
}

.card-body {
    padding: 20px 24px 24px;
}

/* === Forms === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group label svg {
    color: var(--gray-400);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.93rem;
    font-family: var(--font-family);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    color: var(--gray-900);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.input-hint {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 5px;
    transition: var(--transition);
}

.input-hint.active {
    color: var(--primary);
    font-weight: 600;
}

/* === Input Error State === */
.input-error-border {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px var(--danger-light) !important;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.input-error {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--danger);
    font-weight: 600;
    margin-top: 6px;
    animation: slideDown 0.3s ease;
}

.input-error svg {
    flex-shrink: 0;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

/* === DP Checkbox Option === */
.dp-checkbox-wrapper {
    cursor: pointer;
    display: block;
}

.dp-checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.dp-checkbox-card {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: var(--transition);
    background: white;
}

.dp-checkbox-card:hover {
    border-color: var(--primary-200);
    background: var(--primary-50);
}

.dp-checkbox-wrapper input:checked~.dp-checkbox-card {
    border-color: var(--primary);
    background: var(--primary-50);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.dp-checkbox-box {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.dp-checkbox-wrapper input:checked~.dp-checkbox-card .dp-checkbox-box {
    background: var(--primary);
    border-color: var(--primary);
}

.dp-check-icon {
    display: none;
    color: white;
}

.dp-checkbox-wrapper input:checked~.dp-checkbox-card .dp-check-icon {
    display: block;
}

.dp-checkbox-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--gray-800);
}

.dp-checkbox-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* === Price Preview === */
.price-preview {
    background: var(--primary-50);
    border: 1.5px solid var(--primary-200);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.price-preview-header {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.price-preview-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.price-preview-row.total {
    border-top: 1.5px solid var(--primary-200);
    margin-top: 8px;
    padding-top: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #86efac, #4ade80);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1.5px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
}

.btn-block {
    width: 100%;
}

/* === Product & Pricing Cards === */
.product-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.product-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--success-light);
    color: var(--success);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
}

.pricing-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pricing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    border: 1.5px solid transparent;
    transition: var(--transition);
}

.pricing-item.active {
    background: var(--primary-50);
    border-color: var(--primary-200);
}

.pricing-range {
    font-size: 0.85rem;
    color: var(--gray-700);
    font-weight: 500;
}

.pricing-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

/* === Alert === */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 24px;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.alert-success a {
    color: var(--success);
    font-weight: 700;
    text-decoration: underline;
}

/* === Admin === */
.admin-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--gray-900);
    color: white;
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
}

.sidebar-brand h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.sidebar-brand p {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 2px;
}

.sidebar-menu {
    list-style: none;
    padding: 0 8px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--gray-400);
    font-size: 0.87rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-menu li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.sidebar-menu li a.active {
    background: var(--primary);
    color: white;
}

.sidebar-menu li a svg {
    flex-shrink: 0;
}

.admin-main {
    padding: 28px 32px;
    background: var(--gray-50);
}

.admin-page-header {
    margin-bottom: 28px;
}

.admin-page-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.admin-page-header p {
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* === Data Table === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table thead th {
    background: var(--gray-50);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--gray-200);
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.stat-card .stat-icon.blue {
    background: var(--primary-50);
    color: var(--primary);
}

.stat-card .stat-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.stat-card .stat-icon.yellow {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 2px;
}

/* === Badge === */
.badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary);
}

/* === Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    padding: 28px;
    animation: modalEnter 0.3s ease;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* === Footer === */
.main-footer {
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 16px 0;
    text-align: center;
    margin-top: auto;
}

.main-footer p {
    font-size: 0.82rem;
    color: var(--gray-500);
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray-400);
}

.empty-state svg {
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* === Responsive === */
@media (max-width: 900px) {
    .page-grid {
        grid-template-columns: 1fr;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: relative;
        height: auto;
    }
}

@media (max-width: 640px) {

    /* Container */
    .container {
        padding: 0 14px;
    }

    /* Header: left aligned app-like bar */
    .header-content {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding: 8px 0;
    }

    .logo-section {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0;
        padding: 0;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }

    .logo-icon img {
        width: 24px !important;
        height: 24px !important;
    }

    /* Truncate logo text if too long */
    .logo-text {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .logo-sub {
        display: none;
        /* Hide subtitle on mobile to save space */
    }

    .header-nav {
        width: auto !important;
        gap: 4px;
        flex-shrink: 0;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 0.8rem;
        gap: 4px;
    }

    .nav-link svg {
        width: 14px;
        height: 14px;
    }

    /* Main Content */
    .main-content {
        padding: 20px 0;
    }

    .page-grid {
        gap: 18px;
    }

    /* Cards */
    .card-header {
        padding: 16px 16px 0;
    }

    .card-body {
        padding: 16px;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-subtitle {
        font-size: 0.8rem;
    }

    /* Forms */
    .form-group {
        margin-bottom: 16px;
    }

    .form-group label {
        font-size: 0.82rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 9px 12px;
        font-size: 0.88rem;
    }

    /* Price Preview */
    .price-preview {
        padding: 14px;
    }

    .price-preview-row {
        font-size: 0.84rem;
    }

    .price-preview-row.total {
        font-size: 0.95rem;
    }

    /* Pricing items */
    .pricing-item {
        padding: 8px 10px;
    }

    .pricing-range {
        font-size: 0.8rem;
    }

    .pricing-price {
        font-size: 0.84rem;
    }

    /* DP Checkbox */
    .dp-checkbox-card {
        padding: 12px 14px;
        gap: 10px;
    }

    .dp-checkbox-label {
        font-size: 0.82rem;
    }

    .dp-checkbox-desc {
        font-size: 0.72rem;
    }

    /* Buttons */
    .btn {
        padding: 9px 16px;
        font-size: 0.85rem;
    }

    /* Alert */
    .alert {
        padding: 12px 14px;
        font-size: 0.84rem;
    }

    /* Footer */
    .main-footer {
        padding: 14px 0;
    }

    .main-footer p {
        font-size: 0.75rem;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .stat-card .stat-label {
        font-size: 0.75rem;
    }

    /* Admin Main */
    .admin-main {
        padding: 20px 14px;
    }

    .admin-page-header h1 {
        font-size: 1.2rem;
    }

    /* Modal */
    .modal {
        margin: 16px;
        padding: 20px;
    }
}

@media (max-width: 380px) {
    .container {
        padding: 0 10px;
    }

    .logo-text {
        font-size: 0.85rem;
    }

    .logo-sub {
        display: none;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 0.72rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* === Image Modal (Lightbox) === */
.img-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.img-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.img-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    overflow: hidden;
    background: transparent;
    display: flex;
    flex-direction: column;
}

.img-modal-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
}

.img-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.img-modal-close:hover {
    color: #fca5a5;
}