@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

:root {
    --navy: #18244D;
    --turquoise: #20B9B3;
    --text: #202945;
    --muted: #7B8499;
    --border: #E5E9F0;
    --background: #F4F6FA;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    color: var(--text);
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(32,185,179,.10), transparent 30%),
        radial-gradient(circle at 85% 85%, rgba(24,36,77,.08), transparent 30%),
        var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-container {
    width: 100%;
    max-width: 430px;
}

.login-card {
    background: #fff;
    border: 1px solid rgba(229,233,240,.9);
    border-radius: 22px;
    padding: 38px 34px 28px;
    box-shadow: 0 18px 55px rgba(24,36,77,.09);
}

.brand-mark {
    width: 58px;
    height: 58px;
    border-radius: 17px;
    background: var(--navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 800;
    margin: 0 auto 22px;
    box-shadow: 0 8px 20px rgba(24,36,77,.18);
}

.login-heading {
    text-align: center;
    margin-bottom: 30px;
}

.login-heading h1 {
    font-size: 21px;
    font-weight: 800;
    color: var(--navy);
    margin: 0 0 9px;
}

.login-heading p {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 9px;
}

.form-group input {
    width: 100%;
    height: 49px;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 0 14px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: #FCFCFE;
    outline: none;
    transition: .2s;
}

.form-group input:focus {
    border-color: var(--turquoise);
    box-shadow: 0 0 0 3px rgba(32,185,179,.12);
    background: #fff;
}

.form-group input::placeholder {
    color: #A7AFBE;
}

button {
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 11px;
    background: var(--navy);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
    margin-top: 5px;
}

button:hover {
    background: #25366F;
    transform: translateY(-1px);
}

button:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
}

.message {
    display: none;
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 12px;
    margin-bottom: 13px;
}

.message.error {
    display: block;
    color: #B42318;
    background: #FEF3F2;
}

.message.success {
    display: block;
    color: #067647;
    background: #ECFDF3;
}

.login-footer {
    border-top: 1px solid #F0F1F5;
    margin-top: 25px;
    padding-top: 19px;
    text-align: center;
    font-size: 11px;
    color: #929BAD;
}

.page-caption {
    text-align: center;
    direction: ltr;
    font-size: 11px;
    color: #A0A8B7;
    margin-top: 22px;
    letter-spacing: 1px;
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 22px 24px;
    }

    .login-heading h1 {
        font-size: 19px;
    }
}

/* Dashboard */

.dashboard-page {
    min-height: 100vh;
    background: #F4F6FA;
}

.topbar {
    min-height: 76px;
    background: #fff;
    border-bottom: 1px solid #E9ECF2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px max(5%, calc((100% - 1200px) / 2));
    gap: 20px;
}

.topbar-brand,
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark.small {
    width: 43px;
    height: 43px;
    border-radius: 12px;
    margin: 0;
    font-size: 23px;
}

.topbar-brand strong,
.topbar-brand span,
.user-info strong,
.user-info span {
    display: block;
}

.topbar-brand strong {
    color: #18244D;
    font-size: 14px;
}

.topbar-brand span {
    color: #929BAD;
    font-size: 10px;
    direction: ltr;
    text-align: right;
    margin-top: 3px;
}

.user-info {
    text-align: left;
}

.user-info strong {
    font-size: 12px;
    color: #18244D;
}

.user-info span {
    font-size: 10px;
    color: #929BAD;
    margin-top: 3px;
}

.logout-button {
    width: auto;
    height: 37px;
    padding: 0 16px;
    margin: 0;
    border: 1px solid #E8EAF0;
    background: #fff;
    color: #68738A;
    font-size: 12px;
}

.logout-button:hover {
    background: #FFF4F3;
    color: #B42318;
    transform: none;
}

.dashboard-container {
    width: min(1120px, 90%);
    margin: 35px auto;
}

.welcome-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
}

.welcome-section h1 {
    color: #18244D;
    font-size: 23px;
    margin: 0 0 7px;
}

.welcome-section p,
.section-heading p,
.result-heading p {
    color: #8791A4;
    font-size: 12px;
    margin: 0;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #16866E;
    background: #EAF8F4;
    padding: 9px 13px;
    border-radius: 30px;
    font-size: 11px;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #20B98B;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #E9ECF2;
    border-radius: 14px;
    padding: 18px;
}

.stat-icon {
    width: 43px;
    height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 700;
}

.stat-icon.turquoise {
    color: #159D98;
    background: #E8F8F7;
}

.stat-icon.navy {
    color: #18244D;
    background: #EEF0F8;
}

.stat-card span,
.stat-card strong {
    display: block;
}

.stat-card span {
    color: #929BAD;
    font-size: 11px;
    margin-bottom: 5px;
}

.stat-card strong {
    color: #18244D;
    font-size: 13px;
}

.lookup-card,
.result-card {
    background: #fff;
    border: 1px solid #E9ECF2;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
}

.section-heading,
.result-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 24px;
}

.section-heading h2,
.result-heading h2 {
    color: #18244D;
    font-size: 17px;
    margin: 0 0 7px;
}

.section-tag {
    color: #159D98;
    background: #E8F8F7;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 10px;
    direction: ltr;
}

.lookup-card form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.lookup-input-row {
    display: flex;
    gap: 10px;
}

.lookup-input-row input {
    flex: 1;
    min-width: 0;
    height: 49px;
    border: 1px solid #E2E6EE;
    border-radius: 10px;
    padding: 0 14px;
    font-family: inherit;
    font-size: 14px;
    direction: ltr;
    text-align: left;
    outline: none;
}

.lookup-input-row input:focus {
    border-color: #20B9B3;
    box-shadow: 0 0 0 3px rgba(32,185,179,.10);
}

.lookup-input-row button {
    width: 165px;
    height: 49px;
    margin: 0;
    flex-shrink: 0;
}

.input-hint {
    color: #A0A8B7;
    font-size: 10px;
    margin-top: 9px;
}

.copy-button {
    width: auto;
    height: 37px;
    padding: 0 13px;
    margin: 0;
    background: #E8F8F7;
    color: #159D98;
    font-size: 11px;
}

.copy-button:hover {
    background: #D8F3F1;
    transform: none;
}

.product-result {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.product-field {
    min-width: 0;
    padding: 13px;
    background: #F7F8FB;
    border: 1px solid #EEF0F4;
    border-radius: 10px;
}

.product-field span {
    display: block;
    color: #8993A5;
    font-size: 10px;
    margin-bottom: 7px;
}

.product-field strong {
    display: block;
    color: #26314E;
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
    direction: auto;
}

.dashboard-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #A0A8B7;
    font-size: 10px;
    padding: 18px 2px;
}

.dashboard-footer span:first-child {
    direction: ltr;
}

@media (max-width: 650px) {
    .topbar {
        padding: 12px 5%;
    }

    .dashboard-container {
        width: 92%;
        margin-top: 25px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .welcome-section {
        align-items: flex-start;
    }

    .welcome-section h1 {
        font-size: 20px;
    }

    .lookup-card,
    .result-card {
        padding: 18px;
    }

    .lookup-input-row {
        flex-direction: column;
    }

    .lookup-input-row button {
        width: 100%;
    }

    .product-result {
        grid-template-columns: 1fr;
    }

    .dashboard-footer {
        flex-direction: column;
    }
}

/* Individual field copy buttons */

.product-field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.product-field-head span {
    margin: 0;
}

.copy-field-button {
    width: auto;
    height: 25px;
    padding: 0 9px;
    margin: 0;
    border: 1px solid #D8F0EE;
    border-radius: 6px;
    background: #EAF8F7;
    color: #159D98;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.copy-field-button:hover {
    background: #D8F3F1;
    transform: none;
}

.copy-field-button.copied {
    background: #EAF8F0;
    border-color: #C5EAD4;
    color: #16834D;
}

/* Lookup history */

.history-card {
    background: #fff;
    border: 1px solid #E9ECF2;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
}

.history-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    margin-bottom: 20px;
}

.history-filter label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.history-filter input {
    width: 100%;
    height: 41px;
    min-width: 0;
    border: 1px solid #E2E6EE;
    border-radius: 9px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 11px;
    outline: none;
    color: #26314E;
}

.history-filter input:focus {
    border-color: #20B9B3;
}

.history-search-button {
    height: 41px;
    margin: 0;
    font-size: 11px;
}

.history-summary {
    display: flex;
    gap: 7px;
    align-items: center;
    color: #8993A5;
    font-size: 11px;
    margin: 15px 0;
}

.history-summary strong {
    color: #18244D;
}

.history-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
    text-align: right;
}

.history-table th {
    background: #F7F8FB;
    color: #7D879A;
    font-size: 11px;
    font-weight: 600;
    padding: 13px 12px;
    white-space: nowrap;
}

.history-table td {
    border-bottom: 1px solid #F0F1F5;
    padding: 13px 12px;
    font-size: 11px;
    color: #39445E;
    white-space: nowrap;
}

.history-uid {
    direction: ltr;
    text-align: right;
    font-weight: 600;
}

.history-status {
    display: inline-block;
    border-radius: 20px;
    padding: 5px 9px;
    font-size: 10px;
}

.history-status.success {
    background: #EAF8F0;
    color: #16834D;
}

.history-status.failed {
    background: #FEF3F2;
    color: #B42318;
}

.history-copy-button {
    width: auto;
    height: 28px;
    padding: 0 10px;
    margin: 0;
    background: #EAF8F7;
    color: #159D98;
    font-size: 10px;
}

.history-copy-button:hover {
    background: #D8F3F1;
    transform: none;
}

.history-empty {
    text-align: center;
    color: #929BAD !important;
    padding: 28px !important;
}

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 20px;
    color: #7D879A;
    font-size: 11px;
}

.page-button {
    width: auto;
    height: 34px;
    padding: 0 15px;
    margin: 0;
    font-size: 11px;
}

.page-button:disabled {
    opacity: .4;
}

@media (max-width: 850px) {
    .history-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .history-card {
        padding: 16px;
    }

    .history-filters {
        grid-template-columns: 1fr;
    }

    .history-pagination {
        gap: 10px;
    }
}

/* Persian Calendar */

.history-filter {
    position: relative;
}

.persian-calendar-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    width: 300px;
    max-width: calc(100vw - 40px);
    padding: 14px;
    background: #ffffff;
    border: 1px solid #e5eaf0;
    border-radius: 14px;
    box-shadow: 0 12px 35px rgba(24, 36, 78, 0.16);
    color: #18244d;
    direction: rtl;
}

.pc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.pc-header strong {
    font-size: 14px;
    font-weight: 700;
}

.pc-nav {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: #f0f4f8;
    color: #18244d;
    font-size: 23px;
    cursor: pointer;
}

.pc-nav:hover {
    background: #20b9b3;
    color: #ffffff;
}

.pc-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    text-align: center;
}

.pc-weekday {
    padding: 8px 0;
    color: #718096;
    font-size: 11px;
    font-weight: 600;
}

.pc-day,
.pc-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 34px;
}

.pc-day {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #26334d;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.pc-day:hover {
    background: #e7f8f7;
    color: #078e88;
}

.pc-day.today {
    border: 1px solid #20b9b3;
    color: #078e88;
    font-weight: 700;
}

.pc-day.selected {
    background: #18244d;
    color: #ffffff;
    font-weight: 700;
}

.pc-footer {
    display: flex;
    justify-content: flex-start;
    border-top: 1px solid #edf0f4;
    margin-top: 12px;
    padding-top: 10px;
}

.pc-footer button {
    border: 0;
    background: transparent;
    color: #d34b4b;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

@media (max-width: 480px) {
    .persian-calendar-popup {
        width: 280px;
    }
}

/* Persian Calendar Compact Fix */

.persian-calendar-popup {
    width: 270px;
    padding: 10px;
    border-radius: 12px;
}

.pc-header {
    margin-bottom: 10px;
}

.pc-grid {
    gap: 2px;
}

.pc-weekday {
    padding: 6px 0;
    font-size: 9px;
    white-space: nowrap;
    letter-spacing: -0.4px;
}

.pc-day,
.pc-empty {
    height: 30px;
}

.pc-day {
    font-size: 11px;
}

.pc-nav {
    width: 29px;
    height: 29px;
    font-size: 20px;
}

@media (max-width: 480px) {
    .persian-calendar-popup {
        width: 260px;
        max-width: calc(100vw - 32px);
    }

    .pc-weekday {
        font-size: 9px;
    }
}

/* ===== ADMIN USER MANAGEMENT ===== */

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

.admin-create-card {
    margin-bottom: 24px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.admin-form-grid .form-group {
    margin-bottom: 8px;
}

.admin-form-grid select {
    width: 100%;
    height: 49px;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: #FCFCFE;
    outline: none;
}

.admin-form-grid input:focus,
.admin-form-grid select:focus {
    border-color: var(--turquoise);
    box-shadow: 0 0 0 3px rgba(32,185,179,.12);
    background: #fff;
}

.admin-create-button {
    width: auto;
    min-width: 190px;
    padding: 0 24px;
    margin-top: 12px;
}

.admin-users-card {
    margin-bottom: 25px;
}

.admin-users-table {
    min-width: 850px;
}

.user-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.user-status.active {
    color: #067647;
    background: #ECFDF3;
}

.user-status.inactive {
    color: #B42318;
    background: #FEF3F2;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.user-action {
    width: auto;
    height: 32px;
    padding: 0 10px;
    margin: 0;
    border-radius: 7px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    transform: none;
}

.user-action:hover {
    transform: none;
}

.user-action.disable {
    color: #B54708;
    background: #FFF4E5;
}

.user-action.enable {
    color: #067647;
    background: #ECFDF3;
}

.user-action.password {
    color: #3448A0;
    background: #EEF2FF;
}

.user-action.delete {
    color: #B42318;
    background: #FEF3F2;
}

.user-action.disable:hover {
    background: #FFE8C7;
}

.user-action.enable:hover {
    background: #D1FADF;
}

.user-action.password:hover {
    background: #E0E7FF;
}

.user-action.delete:hover {
    background: #FEE4E2;
}

@media (max-width: 850px) {
    .admin-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .admin-stats {
        grid-template-columns: 1fr;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .admin-create-button {
        width: 100%;
    }

    .admin-users-table {
        min-width: 800px;
    }

    .user-actions {
        gap: 4px;
    }

    .user-action {
        padding: 0 8px;
        font-size: 9px;
    }
}


/* ===== ADMIN UI REFINEMENT ===== */

/* Access level select */
.admin-form-grid select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 48px;
    padding: 0 14px 0 38px;
    border: 1px solid #E3E8F0;
    border-radius: 11px;
    background-color: #FCFCFE;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2356677B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 13px center;
    color: #18244D;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s ease;
}

.admin-form-grid select:hover {
    border-color: #20B9B3;
    background-color: #FFFFFF;
}

.admin-form-grid select:focus {
    border-color: #20B9B3;
    box-shadow: 0 0 0 3px rgba(32,185,179,.12);
    outline: none;
}

.admin-form-grid select option {
    padding: 10px;
    background: #FFFFFF;
    color: #18244D;
}

/* Compact users table */
.admin-users-table {
    width: 100%;
    min-width: 720px;
    table-layout: fixed;
}

.admin-users-table th:nth-child(1),
.admin-users-table td:nth-child(1) {
    width: 6%;
}

.admin-users-table th:nth-child(2),
.admin-users-table td:nth-child(2) {
    width: 17%;
}

.admin-users-table th:nth-child(3),
.admin-users-table td:nth-child(3) {
    width: 13%;
}

.admin-users-table th:nth-child(4),
.admin-users-table td:nth-child(4) {
    width: 11%;
}

.admin-users-table th:nth-child(5),
.admin-users-table td:nth-child(5) {
    width: 17%;
}

.admin-users-table th:nth-child(6),
.admin-users-table td:nth-child(6) {
    width: 36%;
}

/* Smaller action buttons */
.user-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.user-action {
    height: 28px;
    min-width: 0;
    padding: 0 7px;
    margin: 0;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transform: none;
}

.user-action:hover {
    transform: none;
}

@media (max-width: 600px) {
    .admin-users-table {
        min-width: 720px;
    }

    .user-action {
        height: 27px;
        padding: 0 6px;
        font-size: 9px;
    }
}


/* ===== NAVIGATION LINKS AS BUTTONS ===== */

.history-nav-link,
.welcome-section a[href="/dashboard"],
.welcome-section a[href="/history"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 17px;
    border: 1px solid #DCE5EF;
    border-radius: 10px;
    background: #FFFFFF;
    color: #18244D;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all .2s ease;
}

.history-nav-link:hover,
.welcome-section a[href="/dashboard"]:hover,
.welcome-section a[href="/history"]:hover {
    color: #FFFFFF;
    background: #18244D;
    border-color: #18244D;
    transform: translateY(-1px);
}


/* ===== DASHBOARD NAVIGATION ===== */
.dashboard-nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 650px) {
    .dashboard-nav-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

