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

body {
    font-family: 'Heebo', sans-serif;
    font-weight: 400;
    background: #fafaf8;
    color: #1f2937;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    min-height: 100vh;
}

/* === Navbar === */
.navbar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-link {
    color: #6b7280;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: #1f2937;
    background: #f3f4f6;
}

.nav-link.active {
    color: #6366f1;
    background: #eef2ff;
}

.nav-logout {
    color: #9ca3af;
    font-size: 0.85rem;
}

/* === Container === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* === Flash Messages === */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease;
}

.flash-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.flash-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

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

/* === Login === */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #eef2ff 0%, #fafaf8 100%);
}

.login-card {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    text-align: center;
    width: 100%;
    max-width: 380px;
}

.login-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #6366f1;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: #9ca3af;
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 2rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-family: 'Heebo', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-primary {
    background: #6366f1;
    color: white;
}

.btn-primary:hover {
    background: #4f46e5;
}

.btn-full {
    width: 100%;
}

.btn-small {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border: none;
    border-radius: 6px;
    font-family: 'Heebo', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-received {
    background: #ecfdf5;
    color: #065f46;
}
.btn-received:hover {
    background: #d1fae5;
}

.btn-edit {
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
}
.btn-edit:hover {
    background: #e5e7eb;
}

.btn-delete {
    background: #fef2f2;
    color: #991b1b;
}
.btn-delete:hover {
    background: #fecaca;
}

.btn-pause {
    background: #fffbeb;
    color: #92400e;
}
.btn-pause:hover {
    background: #fef3c7;
}

.btn-tiny {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border: none;
    border-radius: 4px;
    font-family: 'Heebo', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

/* === Inputs === */
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Heebo', sans-serif;
    font-size: 0.95rem;
    color: #1f2937;
    background: white;
    transition: border-color 0.15s ease;
    direction: rtl;
}

.input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input::placeholder {
    color: #9ca3af;
}

.textarea {
    resize: vertical;
    min-height: 60px;
}

/* === Shotef Pills === */
.shotef-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pill {
    cursor: pointer;
}

.pill input[type="radio"] {
    display: none;
}

.pill span {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.15s ease;
}

.pill input[type="radio"]:checked + span {
    border-color: #6366f1;
    background: #eef2ff;
    color: #6366f1;
}

.pill span:hover {
    border-color: #a5b4fc;
}

/* === Forms === */
.form-page {
    max-width: 540px;
    margin: 0 auto;
}

.form-page h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.form-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}

/* === Page Header === */
.page-header, .dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1, .dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

/* === Alert === */
.alert-overdue {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #fef2f2;
    border-radius: 12px;
    border-right: 4px solid #ef4444;
    margin-bottom: 1.5rem;
}

.alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.alert-content strong {
    color: #991b1b;
    font-size: 0.9rem;
}

.alert-list {
    list-style: none;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.alert-list li {
    font-size: 0.85rem;
    color: #7f1d1d;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.alert-date {
    color: #b91c1c;
    font-size: 0.8rem;
}

/* === Months Grid === */
.months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* === Month Card === */
.month-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 1.25rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.month-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.month-current {
    border: 2px solid #6366f1;
}

.month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.month-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
}

.badge-current {
    background: #eef2ff;
    color: #6366f1;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

/* === Month Sections === */
.month-section {
    margin-bottom: 0.75rem;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.income-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    font-size: 0.9rem;
}

.income-name {
    flex: 1;
    color: #374151;
}

.income-amount {
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: embed;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-pending { background: #f59e0b; }
.dot-received { background: #10b981; }
.dot-overdue { background: #ef4444; }
.dot-recurring { background: #6366f1; }
.dot-inactive { background: #d1d5db; }

.month-empty {
    color: #9ca3af;
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem 0;
}

.month-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
    font-weight: 500;
    color: #374151;
}

.total-amount {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
    direction: ltr;
    unicode-bidi: embed;
}

/* === Invoice List === */
.invoice-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invoice-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 1rem 1.25rem;
    transition: box-shadow 0.15s ease;
}

.invoice-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.invoice-overdue {
    border-right: 3px solid #ef4444;
}

.invoice-received {
    border-right: 3px solid #10b981;
    opacity: 0.85;
}

.invoice-inactive {
    opacity: 0.6;
}

.invoice-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.invoice-info {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    flex: 1;
}

.invoice-info .status-dot {
    margin-top: 0.5rem;
}

.invoice-meta {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 0.15rem;
}

.invoice-notes {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.invoice-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: embed;
}

.invoice-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.received-label {
    font-size: 0.8rem;
    color: #10b981;
    font-weight: 500;
}

.inactive-badge {
    display: inline-block;
    font-size: 0.7rem;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-right: 0.25rem;
}

.per-month {
    font-size: 0.75rem;
    font-weight: 400;
    color: #9ca3af;
}

/* === Filter Tabs === */
.filter-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    background: white;
    border-radius: 10px;
    padding: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    width: fit-content;
}

.tab {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.15s ease;
}

.tab:hover {
    color: #1f2937;
    background: #f9fafb;
}

.tab-active {
    background: #6366f1;
    color: white;
}

.tab-active:hover {
    background: #4f46e5;
    color: white;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.empty-state p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* === Inline Forms === */
.inline-form {
    display: inline-flex;
}

/* === Responsive === */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .months-grid {
        grid-template-columns: 1fr;
    }

    .nav-container {
        padding: 0 1rem;
    }

    .nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

    .dashboard-header h1, .page-header h1 {
        font-size: 1.25rem;
    }

    .invoice-main {
        flex-direction: column;
        gap: 0.5rem;
    }

    .invoice-amount {
        font-size: 1rem;
    }
}
