:root {
    --brand-primary: #0f4c81;
    --brand-primary-soft: #eaf2fb;
    --brand-accent: #1f7a8c;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border-soft: #dce3ed;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --success: #1e9b61;
    --danger: #d64545;
}

body {
    font-family: 'Vazirmatn', 'Poppins', sans-serif;
    background: var(--surface-muted);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.main-header {
    background: var(--surface);
    border-color: var(--border-soft) !important;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 18px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary-soft);
    border: 1px solid rgba(15, 76, 129, 0.16);
}

.site-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.site-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.owner-header-strip {
    background: var(--surface-muted);
    border: 1px solid var(--border-soft);
}

.owner-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--brand-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.map-link {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.map-link:hover {
    color: var(--brand-accent);
    opacity: 0.85;
}

.footer-social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-soft);
}

.social-icon-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-muted);
    color: var(--brand-primary);
    text-decoration: none;
    font-size: 1.25rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border-soft);
}

.social-icon-btn:hover {
    color: #fff;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.social-icon-btn.address:hover {
    background: #4285f4;
    border-color: #4285f4;
}

.social-icon-btn.whatsapp:hover {
    background: #25d366;
    border-color: #25d366;
}

.social-icon-btn.instagram:hover {
    background: #e4405f;
    border-color: #e4405f;
}

.social-icon-btn.tiktok:hover {
    background: #000000;
    border-color: #000000;
}

.social-icon-btn.facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
}

.social-icon-btn.snapchat:hover {
    background: #FFFC00;
    border-color: #FFFC00;
    color: #000;
}

.owner-header-meta {
    color: var(--brand-primary);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.owner-header-meta span {
    color: inherit;
}

.owner-header-meta a,
.owner-phone-line a {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 600;
}

.owner-header-meta a[href^="tel:"] {
    direction: ltr;
    unicode-bidi: isolate;
    white-space: nowrap;
    font-family: 'Poppins', sans-serif;
}

.owner-header-meta a:hover,
.owner-phone-line a:hover {
    color: var(--brand-accent);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    padding-bottom: 12px;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-soft);
}

.section-title i,
.last-updated i {
    color: var(--brand-primary);
}

.currency-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.currency-table thead th {
    border-bottom: 2px solid var(--border-soft);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 14px;
}

.currency-table tbody tr {
    transition: background-color 0.2s ease;
}

.currency-table tbody tr:hover {
    background: #f2f7fc;
}

.currency-table td {
    padding: 16px 14px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

.currency-code {
    font-weight: 700;
    color: var(--text-primary);
    margin-inline-end: 8px;
}

.currency-name {
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.currency-flag-img {
    width: 65px;
    height: auto;
}

.rate-box {
    display: inline-block;
    min-width: 104px;
    text-align: center;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid transparent;
}

.rate-buy {
    background: #ebf8f1;
    border-color: #cdeedd;
    color: #176d46;
}

.rate-sell {
    background: #fae6e6;
    border-color: #ffc3c3;
    color: #0f4c81;
}

.rate-change {
    font-size: 0.75rem;
    margin-inline-start: 6px;
}

.rate-change.up {
    color: var(--success);
}

.rate-change.down {
    color: var(--danger);
}

.refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--brand-primary-soft);
    border: 1px solid #d8e7f8;
    color: var(--brand-primary);
    font-size: 0.85rem;
    font-weight: 600;
}

.refresh-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 1.8s infinite;
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f4f7fb;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 4px;
}

.lang-switcher a {
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
}

.lang-switcher a:hover {
    color: var(--brand-primary);
    background: #eaf2fb;
}

.lang-switcher a.active {
    color: #ffffff;
    background: var(--brand-primary);
}

.last-updated {
    margin-top: 14px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.main-footer {
    background: var(--surface);
    border-color: var(--border-soft) !important;
}

.owner-footer-card {
    border-color: var(--border-soft) !important;
}

.owner-footer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-soft);
}

.owner-footer-title {
    margin: 0;
    font-size: 1rem;
    color: var(--brand-primary);
    font-size: 1.9rem;
    font-weight: 600;
}

.owner-footer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--brand-primary);
    font-size: 0.86rem;
    font-weight: 600;
}

.owner-phone-line {
    background: #f9fbfd;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 8px 10px;
    color: var(--text-primary);
    font-weight: 600;
    gap: 10px;
}

.owner-phone-line .label {
    color: var(--text-secondary);
}

.owner-phone-line .phone-number {
    direction: ltr;
    unicode-bidi: isolate;
    white-space: nowrap;
    font-family: 'Poppins', sans-serif;
}

.footer-text {
    margin: 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loader-logo {
    width: 120px;
    height: auto;
    animation: pulse-logo 2s infinite ease-in-out;
}


.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--brand-primary-soft);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-logo {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }
}

@media (max-width: 768px) {
    .logo-section img {
        width: 240px !important;
    }

    .site-title {
        font-size: 1.35rem;
    }

    .currency-table-container {
        padding: 1rem !important;
    }

    .currency-table td,
    .currency-table thead th {
        padding: 8px 6px;
        font-size: 0.78rem;
    }

    .rate-box {
        min-width: 74px;
        padding: 6px 8px;
        font-size: 0.78rem;
    }

    .currency-code {
        display: block;
        margin-inline-end: 0;
    }

    .currency-name {
        display: block;
        font-size: 0.74rem;
    }

    .currency-flag-img {
        width: 34px;
    }

    .owner-header-top,
    .owner-header-meta,
    .owner-footer-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

@media (max-width: 576px) {
    /* .table-responsive {
        overflow-x: hidden;
    }

    .currency-table {
        table-layout: fixed;
    } */

    .currency-table td,
    .currency-table thead th {
        padding: 6px 4px;
        font-size: 0.72rem;
    }

    .rate-box {
        min-width: 64px;
        padding: 5px 6px;
        font-size: 0.72rem;
    }

    .currency-flag-img {
        width: 30px;
    }

    .logo-section img {
        width: 200px !important;
    }
}

/* Admin Login */
.admin-login-page {
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 82px;
    height: 82px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--brand-primary);
    background: var(--brand-primary-soft);
    border: 1px solid #d8e7f8;
}

.login-title {
    margin-bottom: 0.2rem;
    color: var(--text-primary);
    font-size: 1.45rem;
    font-weight: 700;
}

.login-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.alert-error {
    border: 1px solid #f3c7c7;
    background: #fef2f2;
    color: #b42318;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.back-link {
    text-align: center;
    margin-top: 1.1rem;
}

.back-link a {
    text-decoration: none;
    color: var(--brand-primary);
    font-weight: 600;
}

.back-link a:hover {
    color: var(--brand-accent);
}

.form-control.with-icon {
    border-inline-end: none;
}

.input-group-text {
    background: #f8fafc;
    border-color: #d8e0ea;
    color: var(--text-secondary);
}

.btn-login {
    width: 100%;
    margin-top: 0.5rem;
    border: 1px solid #0f4c81;
    background: #0f4c81;
    color: #fff;
    font-weight: 700;
    border-radius: 10px;
    padding: 0.72rem 1rem;
}

.btn-login:hover {
    background: #0d426f;
    border-color: #0d426f;
    color: #fff;
}

/* Admin Dashboard */
.admin-dashboard-page .main-content {
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1.2rem;
}

.page-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.6rem;
    font-weight: 700;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
    font-weight: 700;
}

.admin-menu {
    min-width: 220px;
    border-color: var(--border-soft);
}

.admin-menu .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    gap: 10px;
}

.admin-menu .dropdown-item i {
    font-size: 0.9rem;
    color: var(--text-secondary);
    order: 2;
    /* Move icon to the end of the flex container */
}

.admin-menu .dropdown-item span {
    order: 1;
}


.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    padding: 1.2rem;
    border-color: var(--border-soft) !important;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
    background: var(--brand-primary-soft);
    color: var(--brand-primary);
}

.stat-value {
    font-size: 1.7rem;
    line-height: 1.2;
    color: var(--text-primary);
    font-weight: 700;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.stat-status {
    margin-top: 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-status.connected {
    background: #eaf8ef;
    color: #1e9b61;
}

.stat-status.disconnected {
    background: #fef1f1;
    color: #d64545;
}

.content-card {
    border-color: var(--border-soft) !important;
}

.content-card .card-header {
    padding: 0 0 0.85rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
}

.card-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
}

.card-title i {
    color: var(--brand-primary);
}

.btn-action {
    border: 1px solid var(--brand-primary);
    background: var(--brand-primary);
    color: #fff;
    font-weight: 600;
}

.btn-action:hover {
    background: #0d426f;
    border-color: #0d426f;
    color: #fff;
}

.btn-action:disabled {
    opacity: 0.7;
}

.history-table,
.admin-dashboard-page .currency-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.admin-dashboard-page .currency-table th {
    text-align: left;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-soft);
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    padding: 10px;
}

.history-table td,
.admin-dashboard-page .currency-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf2f7;
}

.admin-dashboard-page .currency-table .drag-col,
.admin-dashboard-page .currency-table .position-controls-cell {
    width: 70px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.admin-dashboard-page .currency-table .btn-position {
    background: none;
    border: none;
    color: #95a1b2;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.admin-dashboard-page .currency-table .btn-position:hover {
    background: #f0f4f8;
    color: #0f4c81;
}

.admin-dashboard-page .currency-table .btn-position:active {
    transform: scale(0.95);
}

.admin-dashboard-page .currency-table tbody tr[draggable="true"] {
    cursor: default;
}


.history-table tr:hover,
.admin-dashboard-page .currency-table tr:hover {
    background: #f8fbff;
}

.currency-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-dashboard-page .currency-code {
    color: var(--text-primary);
    font-weight: 700;
}

.admin-dashboard-page .currency-name {
    color: var(--text-secondary);
}

.rate-input-buy {
    width: 120px;
    border: 1px solid #cdffc1;
    border-radius: 8px;
    padding: 7px 10px;
    color: #000;
    font-weight: 700;
    background: #d6ffce;
}

.rate-input-sell {
    width: 120px;
    border: 1px solid #ff9393;
    border-radius: 8px;
    padding: 7px 10px;
    color: #000;
    font-weight: 700;
    background: #ffa8a8;
}

.rate-input:focus {
    outline: none;
    border-color: #9bbfe0;
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.12);
}

.visibility-toggle {
    width: 50px;
    height: 26px;
    border-radius: 99px;
    background: #d5dde8;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.visibility-toggle::after {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 3px;
    left: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.visibility-toggle.active {
    background: #b7ebce;
}

.visibility-toggle.active::after {
    left: 27px;
    background: #1e9b61;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast-message {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    animation: slideIn 0.25s ease;
}

.toast-message.success {
    border-color: #cdeedd;
}

.toast-message.error {
    border-color: #f3c7c7;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 992px) {
    .admin-dashboard-page .main-content {
        padding: 1rem !important;
    }
}

/* Modal Close Button - make visible */
.btn-close {
    opacity: 0.8;
    filter: invert(1) grayscale(100%) contrast(2);
    -webkit-filter: invert(1) grayscale(100%) contrast(2);
}

/* Fix modal close button position in RTL */
html[dir="rtl"] .modal-header {
    position: relative;
}

html[dir="rtl"] .modal-header .btn-close {
    position: absolute !important;
    left: 1rem !important;
    right: auto !important;
    margin: 0 !important;
}