/* ===== HANE FRUITS - Custom Stylesheet ===== */

:root {
    --primary:        #2d6b1e;
    --primary-dark:   #1e4d14;
    --primary-light:  #4a9c2d;
    --primary-tint:   #e8f5e0;
    --accent:         #f5923e;
    --accent-dark:    #d97a28;
    --accent-tint:    #fff3e8;
    --bg:             #f4f0e8;
    --bg-card:        #ffffff;
    --sidebar-w:      260px;
    --text:           #1a2b1a;
    --text-muted:     #5a6872;
    --border:         #e0ddd4;
    --shadow:         0 2px 12px rgba(45,107,30,.10);
    --shadow-md:      0 4px 24px rgba(45,107,30,.14);
    --radius:         12px;
    --radius-sm:      8px;
    --transition:     all .2s ease;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Heebo', 'Arial', sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: #fff;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0,0,0,.06);
}

.sidebar-logo-wrap {
    padding: 24px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-wrap img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 10px;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
}
.sidebar-brand-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}
.sidebar-brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: .5px;
    font-weight: 500;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: .8px;
    padding: 12px 20px 4px;
    text-transform: uppercase;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 15px;
    border-radius: 0;
    transition: var(--transition);
    position: relative;
}

.sidebar-nav a:hover {
    background: var(--primary-tint);
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary-tint);
    color: var(--primary);
    font-weight: 700;
}

.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #c0392b;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-footer a:hover {
    background: #fdecea;
}

/* ===== Main Content ===== */
.main-content {
    margin-right: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(0,0,0,.05);
}

.topbar-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

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

.content-area {
    padding: 28px;
    flex: 1;
}

/* ===== Stat Cards ===== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.green  { background: var(--primary-tint); color: var(--primary); }
.stat-icon.orange { background: var(--accent-tint);  color: var(--accent); }
.stat-icon.blue   { background: #e3f2fd; color: #1565c0; }
.stat-icon.purple { background: #f3e5f5; color: #7b1fa2; }

.stat-info { flex: 1; min-width: 0; }

.stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ===== Cards ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--primary);
}

.card-body {
    padding: 24px;
}

/* ===== Tables ===== */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background: #f8f9fa;
    padding: 12px 16px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid #f0ece4;
    vertical-align: middle;
}

.table tbody tr:hover td {
    background: #fafaf8;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-paid   { background: #e8f5e0; color: #1e5210; }
.badge-unpaid { background: #fff3e8; color: #c05a00; }
.badge-green  { background: var(--primary-tint); color: var(--primary); }
.badge-gray   { background: #f0ece4; color: var(--text-muted); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Heebo', Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-accent {
    background: var(--accent);
    color: #fff;
}
.btn-accent:hover {
    background: var(--accent-dark);
    color: #fff;
}

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

.btn-danger {
    background: #dc3545;
    color: #fff;
}
.btn-danger:hover {
    background: #b02a37;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}

/* ===== Forms ===== */
.form-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Heebo', Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: var(--transition);
    direction: rtl;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(74,156,45,.12);
}

.form-control::placeholder {
    color: #aaa;
}

select.form-control {
    appearance: none;
    -webkit-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='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 32px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

/* ===== Modal ===== */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1040;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop-custom.show {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: modalIn .25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.96) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

/* ===== Search Box ===== */
.search-box {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-box i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.search-box input {
    padding-right: 36px;
}

/* ===== Toast Notification ===== */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    min-width: 260px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    animation: toastIn .3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.toast-msg.success { background: #2d6b1e; color: #fff; }
.toast-msg.error   { background: #c0392b; color: #fff; }
.toast-msg.info    { background: #1565c0; color: #fff; }

/* ===== Customer Card Header ===== */
.customer-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius);
    padding: 28px 32px;
    color: #fff;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.customer-avatar {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,.22);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    flex-shrink: 0;
}

.customer-info h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}

.customer-info p {
    opacity: .85;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== Mini Stats ===== */
.mini-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.mini-stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
}

.mini-stat-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

.mini-stat-lbl {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ===== Toggle Paid Button ===== */
.toggle-paid {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: 'Heebo', Arial, sans-serif;
}

.toggle-paid.paid   { background: #e8f5e0; color: #1e5210; }
.toggle-paid.unpaid { background: #fff3e8; color: #c05a00; }
.toggle-paid:hover  { filter: brightness(.93); }

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

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 12px 48px rgba(45,107,30,.18);
    text-align: center;
}

.login-logo {
    width: 110px;
    margin-bottom: 8px;
}

.login-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.login-card .form-label { text-align: right; }

.login-btn {
    width: 100%;
    padding: 13px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Heebo', Arial, sans-serif;
    transition: var(--transition);
    margin-top: 4px;
}
.login-btn:hover { background: var(--primary-dark); }

.login-error {
    background: #fdecea;
    color: #c0392b;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: right;
}

/* ===== Dashboard Chart ===== */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}

.chart-container {
    position: relative;
    height: 280px;
}

/* ===== Report Page ===== */
.report-filters {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    background: #fff;
    padding: 20px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.report-filters .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 160px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform .3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
    }
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-row {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .mini-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .mobile-menu-btn {
        display: flex !important;
    }
}

@media (max-width: 560px) {
    .stat-cards {
        grid-template-columns: 1fr 1fr;
    }
    .content-area {
        padding: 16px;
    }
    .topbar {
        padding: 12px 16px;
    }
}

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--primary-tint);
    color: var(--primary);
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== Print ===== */
@media print {
    .sidebar, .topbar, .no-print, .btn, button { display: none !important; }
    .main-content { margin-right: 0 !important; }
    .content-area { padding: 0 !important; }
    body { background: #fff; font-size: 13px; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    .table th { background: #f0f0f0 !important; }
}

/* ===== Utilities ===== */
.text-green  { color: var(--primary); }
.text-orange { color: var(--accent); }
.text-muted  { color: var(--text-muted); }
.text-danger { color: #c0392b; }

.fw-bold { font-weight: 700; }
.fw-800  { font-weight: 800; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    opacity: .3;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    font-size: 15px;
}

/* Action buttons in table */
.actions { display: flex; gap: 6px; align-items: center; }
