
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'IRANSansWebFaNum', 'IRANSansWeb', 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    background: var(--card-background);
    color: var(--text-color);
    line-height: 1.5;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
    transform: translateY(-1px);
}

.form-input::placeholder {
    color: #111;
    opacity: 0.35;
    font-size: 0.85rem;
}

.login-tabs {
    display: flex;
    margin: 0 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.login-tab {
    flex: 1;
    margin: 0 0 -1px;
    padding: 0.7rem 0.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
    font-family: 'IRANSansWebFaNum', 'IRANSansWeb', 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
}

.login-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.login-panel[hidden] {
    display: none;
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
    direction: rtl;
}

.send-code-button {
    min-width: 6.5rem;
    padding: 0 0.85rem;
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    font-family: 'IRANSansWebFaNum', 'IRANSansWeb', 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
}

.send-code-button:hover:not(:disabled) {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: var(--primary-color);
}

.send-code-button:active:not(:disabled) {
    background: rgba(var(--primary-rgb), 0.1);
}

.send-code-button .spinner {
    border-color: rgba(var(--primary-rgb), 0.25);
    border-top-color: var(--primary-color);
}

.send-code-button:disabled {
    opacity: 1;
    cursor: not-allowed;
    color: #9aa0a6;
    border-color: #d5d8dc;
    background: #f3f4f6;
}

.input-with-button .form-input {
    flex: 1;
}

.login-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'IRANSansWebFaNum', 'IRANSansWeb', 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(var(--primary-rgb), 0.4);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled,
.login-button.disabled {
    opacity: 1;
    cursor: not-allowed;
    transform: none;
    background: #c5c8cc;
    background-image: none;
    color: #fff;
    box-shadow: none;
}

.login-button:disabled:hover,
.login-button.disabled:hover {
    transform: none;
    box-shadow: none;
}

.button-text {
    display: inline-block;
    transition: opacity 0.3s ease;
}

.button-loader {
    display: none;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.validation-message {
    display: block;
    margin-top: 0.5rem;
    color: var(--error-color);
    font-size: 0.85rem;
    font-weight: 500;
}

.validation-summary {
    margin-bottom: 1.5rem;
    padding: 16px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    color: var(--error-color);
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.1);
}

.validation-summary ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.validation-summary li {
    margin-bottom: 4px;
}

.validation-summary li:last-child {
    margin-bottom: 0;
}

.otp-message {
    margin-bottom: 1.5rem;
    padding: 16px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.otp-message-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    color: #166534;
}

.otp-message-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    color: var(--error-color);
}

.sidebar-column {
    width: 248px;
    flex: 0 0 248px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    border-left: 1px solid var(--border-color);
}

.sidebar-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 70px;
    height: 70px;
    color: var(--text-color);
    text-decoration: none;
}

.sidebar {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--sidebar);
    color: #fff;
    padding: 1.25rem 0.9rem 1rem;
    border-top-left-radius: 40px;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.sidebar-logo-link strong {
    font-size: 0.95rem;
}

.sidebar-logo {
    display: block;
    max-width: 210px;
    max-height: 45px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.sidebar-foot {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-foot form {
    flex: 1;
    margin: 0;
}

.sidebar-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 3.4rem;
    padding: 0.35rem 0.15rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #e7eef6;
    font-family: inherit;
    font-size: 0.72rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.sidebar-action i {
    font-size: 1.1rem;
}

.sidebar-action:hover,
.sidebar-action.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar-logout {
    width: 100%;
    color: #f0b4b4;
}

.sidebar-logout:hover {
    background: rgba(240, 180, 180, 0.12);
    color: #fff;
}

@media (min-width: 768px) {
    .dashboard-logo-wrapper {
        display: none;
    }
}

.admin-main:has(.dashboard-page) {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-main > .container:has(.dashboard-page) {
    display: flex;
    flex: 1;
    flex-direction: column;
    max-width: none;
    min-height: 0;
    padding: 1.25rem 1.5rem 1.25rem;
}

.admin-main > .container:has(.dashboard-page) > main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 0;
}

.dashboard-page {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.dashboard-page-head h1 {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-color);
}

.admin-main > .container:has(.profile-page) {
    max-width: none;
    padding: 1.25rem 1.5rem 1.5rem;
}

.profile-page {
    width: 100%;
}

.profile-hero {
    background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.1), #fff 72%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem 2rem;
    margin-bottom: 1rem;
}

.profile-hero h1 {
    margin: 0 0 0.4rem;
    font-size: 1.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.profile-hero p {
    margin: 0;
    color: var(--text-color);
    font-size: 1rem;
}

.profile-hero p span {
    margin-inline-end: 0.4rem;
    color: var(--text-light);
}

.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 1rem;
    align-items: stretch;
}

.profile-layout:not(:has(.profile-card:nth-child(2))) {
    grid-template-columns: 1fr;
}

.profile-layout:not(:has(.profile-card:nth-child(2))) .profile-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.35rem 1.5rem 1.5rem;
}

.profile-card h2,
.profile-address h3 {
    margin: 0 0 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.profile-card h2 {
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.15rem;
}

.profile-address {
    background: #f7f9fc;
    border-radius: 12px;
    padding: 1rem 1.1rem 1.1rem;
}

.profile-address + .profile-address {
    margin-top: 0.85rem;
}

.profile-address h3 {
    margin-bottom: 0.85rem;
    font-size: 1rem;
}

.profile-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.1rem;
    margin: 0;
}

.profile-fields .wide {
    grid-column: 1 / -1;
}

.profile-fields dt {
    margin: 0 0 0.35rem;
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 500;
}

.profile-fields dd {
    margin: 0;
    padding: 0.8rem 0.95rem;
    background: #f4f7fb;
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1rem;
    min-height: 2.75rem;
}

.profile-address .profile-fields dd {
    background: #fff;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.kpi-card,
.chart-card,
.dashboard-page .notifications-card,
.dashboard-page .upcoming-payments-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: none;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
}

.kpi-label {
    color: var(--text-light);
    font-size: 0.8rem;
}

.kpi-value {
    color: var(--text-color);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.kpi-unit {
    color: var(--secondary-color);
    font-size: 0.75rem;
}

.chart-card {
    padding: 1rem;
    margin-bottom: 1rem;
}

.chart-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.chart-card-head h2,
.dashboard-page .panel-head h2,
.dashboard-page .upcoming-payments-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.panel-head {
    padding: 0 0 0.75rem;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.bar-track {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 140px;
}

.bar {
    width: 100%;
    max-width: 36px;
    height: var(--bar-height);
    border-radius: 6px 6px 2px 2px;
    background: var(--primary-color);
}

.bar-value,
.bar-label {
    color: var(--text-light);
    font-size: 0.72rem;
}

.bar-value {
    margin-bottom: 0.3rem;
}

.bar-label {
    margin-top: 0.4rem;
    white-space: nowrap;
}

.dashboard-split {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr);
    flex: 1;
    gap: 1rem;
    align-items: stretch;
    min-height: 16rem;
}

.dashboard-page .notifications-card,
.dashboard-page .upcoming-payments-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.dashboard-page .notifications-card {
    animation: none;
    padding: 1rem;
    margin-bottom: 0;
}

.notification-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.dashboard-page .notification-item {
    padding: 0.75rem 0;
}

.dashboard-page .notification-item:first-of-type {
    padding-top: 0;
}

.dashboard-page .notification-item:last-of-type {
    padding-bottom: 0;
    border-bottom: none;
}

.dashboard-page .upcoming-payments-card {
    padding: 1rem;
    margin-bottom: 0;
}

.dashboard-page .upcoming-payments-table {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.dashboard-page .upcoming-payments-scroll {
    flex: 1;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
}

.dashboard-page .upcoming-payments-header {
    margin: 0;
}

.dashboard-page .upcoming-payments-table,
.dashboard-page .upcoming-payments-empty {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.dashboard-page .upcoming-payments-table .table-header,
.dashboard-page .upcoming-payments-table .table-row {
    grid-template-columns: 1fr 1.2fr 1fr 1.1fr;
}

.view-all-link {
    color: var(--primary-color);
    font-size: 0.85rem;
    text-decoration: none;
}

.view-all-link:hover {
    color: var(--primary-hover);
}

.nav-group {
    margin: 1rem 0.7rem 0.35rem;
    color: var(--sidebar-muted);
    font-size: 0.8rem;
}

.sidebar .nav-link {
    display: block;
    color: #e7eef6;
    text-decoration: none;
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    margin-bottom: 0.1rem;
}

.sidebar .nav-link.nav-sub {
    padding-inline-start: calc(0.7rem + 2em);
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar .nav-link.active {
    font-weight: 600;
}

.logout-form {
    display: none;
}

.quick-menu-link {
    width: auto;
    min-width: 120px;
    height: 44px;
    box-sizing: border-box;
    border-radius: 14px;
    background: #f5f7fb;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    transition: background 0.2s ease;
    padding: 0 1rem;
    margin: 0;
    border: none;
    cursor: pointer;
    color: #000;
    text-decoration: none;
}

.quick-menu-link:hover {
    background: #ececf6;
}

.profile-quick-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: none;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.profile-quick-btn:hover {
    transform: translateY(-1px);
    background: var(--primary-hover);
}

.profile-quick-btn i {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.mobile-quick-menu button.quick-menu-link.logout {
    background: #ffe6e6;
}

.mobile-quick-menu button.quick-menu-link.logout:hover {
    background: #ffcccc;
}

.mobile-quick-menu button.quick-menu-link.logout * {
    color: #c53030 !important;
}

.portal-table-wrap {
    width: 100%;
    overflow-x: auto;
}

@media (min-width: 768px) {
    .portal-table-wrap {
        width: calc(100% - 7rem);
        margin-right: auto;
        margin-left: auto;
    }
}

.portal-table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.portal-table th,
.portal-table td {
    padding: 0.5rem;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
    background-color: #fff;
}

.portal-table thead th {
    background-color: rgba(var(--primary-rgb), 0.06);
    font-weight: 600;
    color: var(--primary-color);
    border-bottom-color: rgba(var(--primary-rgb), 0.28);
}

.portal-table thead .portal-filter-row th {
    background-color: #fff;
    color: #212529;
    border-bottom-color: #dee2e6;
}

.portal-table tbody tr:hover td {
    background-color: rgba(var(--primary-rgb), 0.05);
}

.portal-row-link {
    cursor: pointer;
}

.portal-table tfoot td {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.portal-table-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    min-width: 18rem;
    white-space: nowrap;
}

.portal-table-actions .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.portal-table-actions .btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: #fff;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.portal-table-actions .btn-outline-primary:hover,
.portal-table-actions .btn-outline-primary:focus {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.portal-filter-row th {
    background-color: #fff;
    padding: 0.35rem;
}

.portal-filter-input {
    width: 100%;
    min-width: 0;
    padding: 0.3rem 0.45rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #212529;
    font-family: inherit;
    font-size: 0.8rem;
    text-align: center;
}

.portal-filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.portal-filter-actions {
    white-space: nowrap;
}

.portal-filter-actions .btn {
    margin: 0;
    border-radius: 0.2rem;
    white-space: nowrap;
}

.portal-detail-meta,
.portal-detail-footer {
    display: none;
}

.portal-detail-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-right: 1rem;
    padding-left: 1rem;
}

.portal-detail-heading {
    margin: 0;
    font-weight: 350;
    font-size: 1.5rem;
}

.portal-detail-rule {
    flex-grow: 1;
    height: 1px;
    background-color: #e9ecef;
    margin-right: 1rem;
}

.portal-page-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.28);
}

.portal-page-head h2 {
    flex: 1;
    min-width: 0;
    margin: 0;
    text-align: center;
}

.portal-page-head .portal-page-actions {
    flex: 0 0 auto;
    flex-direction: row;
    margin-top: 0;
}

.portal-page-head .portal-page-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-sizing: border-box;
    width: 10rem;
    min-width: 10rem;
    height: 2.75rem;
    margin: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.portal-page-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.portal-page-actions .btn {
    width: 100%;
}

.portal-page-actions .btn-primary,
.portal-detail-actions .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.portal-page-actions .btn-primary:hover:not(:disabled),
.portal-page-actions .btn-primary:focus:not(:disabled),
.portal-detail-actions .btn-primary:hover:not(:disabled),
.portal-detail-actions .btn-primary:focus:not(:disabled) {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

@media (min-width: 768px) {
    .portal-detail-meta {
        display: flex;
        justify-content: center;
        align-items: center;
        max-width: 100%;
        padding: 1rem;
        overflow-x: auto;
        background-color: #f8f9fa;
        border-top-left-radius: 0.375rem;
        border-top-right-radius: 0.375rem;
    }

    .portal-detail-meta-items {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 100%;
        gap: 1rem 2rem;
    }

    .portal-detail-divider {
        height: 2.5rem;
    }

    .portal-detail-name {
        max-width: 220px;
    }

    .portal-detail-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 1rem 1rem 0;
        padding: 1rem;
        background-color: #f8f9fa;
        border-radius: 0.375rem;
    }

    .portal-detail-amount {
        font-size: 1.2rem;
        color: var(--primary-color);
    }

    .portal-detail-actions,
    .portal-page-actions {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 0.75rem;
    }

    .portal-detail-actions .btn,
    .portal-page-actions .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        box-sizing: border-box;
        width: 10rem;
        min-width: 10rem;
        height: 2.75rem;
        margin: 0;
        padding: 0.4rem 0.75rem;
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
    }

    .portal-table tbody .portal-table-actions > .btn-danger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        width: 5.5rem;
        min-width: 5.5rem;
        height: 2rem;
        margin: 0;
        padding: 0.2rem 0.5rem;
        font-size: 0.85rem;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
    }

    .portal-detail-actions .btn img {
        height: 22px;
        margin-left: 8px;
        background: #fff;
        border-radius: 4px;
        padding: 2px;
    }

    .portal-detail-pay-form {
        display: inline-flex;
        margin: 0;
    }
}
