/**
 * Ramadan Operational Application - Mobile First CSS
 * Masjid Al-Wahdah Cluster LLanos
 */

:root {
    --primary-color: #2E7D32;
    --primary-dark: #1B5E20;
    --primary-light: #4CAF50;
    --secondary-color: #FF9800;
    --accent-color: #FFC107;
    --text-dark: #212121;
    --text-light: #757575;
    --bg-light: #F5F5F5;
    --white: #FFFFFF;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #F44336;
    --border-color: #E0E0E0;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Sticky top: header + nav tetap di atas saat scroll (fixed agar konsisten di semua halaman) */
.site-sticky-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* Ruang untuk header + nav fixed agar konten tidak tertutup */
body {
    padding-top: 150px;
}

/* Header */
.header {
    position: relative;
    color: var(--white);
    padding: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, var(--primary-dark) 0%, var(--primary-color) 40%, #256325 100%);
    z-index: 0;
}

.header-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 25 L55 25 L38 38 L43 58 L30 45 L17 58 L22 38 L5 25 L25 25 Z' fill='none' stroke='rgba(255,255,255,0.06)' stroke-width='1'/%3E%3C/svg%3E");
    opacity: 1;
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}
.header-brand:hover,
.header-brand:focus {
    color: inherit;
    text-decoration: none;
}

.header-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    overflow: hidden;
}

.header-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.header-text {
    min-width: 0;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.header-subtitle {
    font-size: 1rem;
    opacity: 0.95;
    margin: 4px 0 0 0;
    font-weight: 500;
    line-height: 1.4;
}

.header-tagline {
    font-size: 0.75rem;
    opacity: 0.85;
    margin: 2px 0 0 0;
}

/* Baris tanggal di bawah header */
.header-date-bar {
    background: var(--white);
    color: var(--text-dark);
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
@media (max-width: 767px) {
    .header-date-bar { margin-bottom: 0.5rem; }
}
@media (min-width: 768px) {
    .header-date-bar { margin-bottom: 2rem; }
}
.header-date-bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header-date-hijri,
.header-date-gregorian {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-dark);
}
.header-date-sep {
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--text-light);
    margin: 0 4px;
}

/* Header mobile view */
@media (max-width: 479px) {
    .header {
        padding: 12px 0;
    }
    .header-content {
        gap: 10px;
    }
    .header-brand {
        min-width: 0;
    }
    .header-title {
        font-size: 1.25rem;
        line-height: 1.2;
    }
    .header-subtitle {
        font-size: 0.9375rem;
    }
    .header-icon {
        width: 42px;
        height: 42px;
    }
    .header-date-bar {
        padding: 10px 0;
    }
    .header-date-bar-inner {
        gap: 8px;
    }
    .header-date-hijri,
    .header-date-gregorian {
        font-size: 0.875rem;
    }
    .header-date-sep {
        font-size: 0.875rem;
    }
}

.header-back {
    border-color: rgba(255, 255, 255, 0.7);
    color: var(--white);
}

.header-back:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--white);
    color: var(--white);
}

@media (min-width: 480px) {
    .header {
        padding: 24px 0;
    }
    .header-icon {
        width: 54px;
        height: 54px;
        font-size: 1.75rem;
    }
    .header-title {
        font-size: 1.625rem;
    }
    .header-subtitle {
        font-size: 0.9375rem;
    }
}

@media (min-width: 768px) {
    .header-title {
        font-size: 1.75rem;
    }
    .header-date-bar-inner {
        justify-content: center;
        gap: 16px;
    }
    .header-date-hijri,
    .header-date-gregorian {
        font-size: 0.9375rem;
    }
    .header-date-sep {
        font-size: 0.9375rem;
    }
}

/* Hamburger di dalam header (mobile) – sejajar dengan logo & nama */
.header-nav-toggle.nav-toggle {
    display: none;
    margin-left: auto;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    color: var(--white);
    font-size: 1.35rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease, transform 0.2s ease;
}
.header-nav-toggle.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}
.header-nav-toggle.nav-toggle:active {
    transform: scale(0.95);
}
.header-nav-toggle.nav-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.35);
}
.nav-toggle .nav-toggle-icon {
    display: block;
    line-height: 1;
    transition: transform 0.2s ease;
}
.header-nav-toggle.nav-toggle:active .nav-toggle-icon {
    transform: scale(0.9);
}
@media (max-width: 767px) {
    .header-content {
        flex-wrap: nowrap;
    }
    .header-nav-toggle.nav-toggle {
        display: inline-flex;
    }
}
@media (max-width: 479px) {
    .header-nav-toggle.nav-toggle {
        width: 42px;
        height: 42px;
    }
}
@media (min-width: 768px) {
    .header-nav-toggle.nav-toggle {
        display: none;
    }
}

.nav-list.collapsed {
    display: none;
}

/* Menu dropdown (mobile: bawah header | desktop: bar horizontal) */
.nav-menu {
    position: relative;
    z-index: 10;
    background: var(--white);
    box-shadow: var(--shadow);
    border-top: 1px solid var(--border-color);
    max-height: 400px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.25s ease;
}
.nav-menu.collapsed {
    max-height: 0;
    opacity: 0;
    border-top-color: transparent;
}
.nav-menu:not(.collapsed) {
    max-height: 400px;
    opacity: 1;
}
@media (max-width: 767px) {
    .nav-menu.collapsed {
        visibility: hidden;
        transition: max-height 0.3s ease-out, opacity 0.25s ease, visibility 0s linear 0.3s;
    }
    .nav-menu:not(.collapsed) {
        visibility: visible;
        transition: max-height 0.3s ease-out, opacity 0.25s ease;
    }
    .nav-link {
        font-size: 0.875rem;
        padding: 10px 16px;
    }
}
@media (min-width: 768px) {
    .nav-menu,
    .nav-menu.collapsed {
        display: block !important;
        max-height: none;
        overflow: visible;
        opacity: 1;
        visibility: visible;
        background: var(--white);
        box-shadow: var(--shadow);
        border-top: 1px solid var(--border-color);
        padding: 0;
    }
    .nav-menu .container {
        padding-top: 0;
        padding-bottom: 0;
    }
    .nav-list {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 0;
        align-items: stretch;
    }
    .nav-item {
        border-bottom: none;
        border-right: none;
    }
    .nav-link {
        padding: 10px 14px;
        white-space: nowrap;
        border-bottom: 3px solid transparent;
        font-size: 0.9375rem;
        border-radius: 2px;
        color: var(--text-dark);
    }
    .nav-link:hover {
        background: rgba(0, 0, 0, 0.04);
    }
    .nav-link:hover,
    .nav-link.active {
        border-bottom-color: var(--primary-color);
    }
    .nav-link.active {
        font-weight: 600;
        color: var(--primary-color);
    }
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 767px) {
    .nav-list {
        flex-direction: column;
    }
}

@media (min-width: 768px) {
    .nav-list {
        flex-direction: row;
    }
}

.nav-item {
    border-bottom: 1px solid var(--border-color);
}

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

.nav-link {
    display: block;
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Main Content */
.main {
    padding: 24px 0 32px;
    min-height: calc(100vh - 200px);
}
@media (max-width: 767px) {
    .main { padding-top: 0.75rem; }
}
@media (min-width: 768px) {
    /* .main { padding-top: 2rem; } */
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    margin-top: 2px;
    overflow: hidden;
}
@media (min-width: 768px) {
    .card { margin-top: 30px; }
}

/* First section / card: negatif margin hanya di mobile (jadwal imam, sanlat, itikaf, zis, ramadhan-berbagi) */
@media (max-width: 767px) {
    .card-booklet { margin-top: -15px; }
    .card-jadwal-imam,
    .card-first-section { margin-top: -30px; }
    .page-ziswaf .card { margin-top: -30px; }
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}

.card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.3;
}

.card-body {
    padding: 16px;
}

.card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

/* Dashboard - grid layanan */
.dashboard-layanan {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
}
@media (min-width: 480px) {
    .dashboard-layanan {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 768px) {
    .dashboard-layanan {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}
.dashboard-layanan a {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--bg-light);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.dashboard-layanan a:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}
.dashboard-layanan .layanan-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}
.dashboard-layanan .layanan-text {
    flex: 1;
    min-width: 0;
}
.dashboard-layanan .layanan-title {
    font-weight: 600;
    font-size: 12px;
    margin: 0 0 2px 0;
}
.dashboard-layanan .layanan-desc {
    font-size: 11px;
    color: var(--text-light);
    margin: 0;
    line-height: 1.4;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

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

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

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

.btn-secondary:hover {
    background: #F57C00;
}

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

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

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

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 12px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.form-control:disabled {
    background-color: var(--bg-light);
    cursor: not-allowed;
}

.form-control::placeholder {
    font-size: 12px;
}

.form-select {
    font-size: 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

.form-text {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
    color: var(--text-light);
}

.form-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border-left: 4px solid var(--success);
}

.alert-warning {
    background: #FFF3E0;
    color: #E65100;
    border-left: 4px solid var(--warning);
}

.alert-danger {
    background: #FFEBEE;
    color: #C62828;
    border-left: 4px solid var(--danger);
}

.alert-info {
    background: #E3F2FD;
    color: #1565C0;
    border-left: 4px solid #2196F3;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

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

.badge-warning {
    background: var(--warning);
    color: var(--white);
}

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

.badge-info {
    background: #2196F3;
    color: var(--white);
}

/* Progress Bar */
.progress {
    height: 24px;
    background: var(--bg-light);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 600;
    transition: width 0.3s;
}

/* List */
.list {
    list-style: none;
}

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

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

/* Grid */
.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.quick-action {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
    text-decoration: none;
    color: var(--text-dark);
    transition: transform 0.3s, box-shadow 0.3s;
}

.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.quick-action-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.quick-action-title {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    padding: 16px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: var(--white);
    padding: 24px 0;
    margin-top: 40px;
}

.footer-content {
    text-align: center;
}

.footer-text {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.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; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.flex-between { justify-content: space-between; }
.flex-center { justify-content: center; align-items: center; }

.text-primary { color: var(--primary-color); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-light); }

.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-normal { font-weight: 400; }

/* Responsive */
@media (min-width: 768px) {
    .header h1,
    .header .header-title {
        font-size: 1.75rem;
    }
    
    .quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .stats {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .btn {
        width: auto;
    }
    
    .grid-md-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-md-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 24px;
    }
    
    .main {
        padding: 2rem 0 32px;
    }
}

/* Jadwal: search (tampilan penuh) */
.jadwal-search-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
