@font-face {
    font-family: 'IRANSansX';
    src: url('../fonts/IRANSansX-Regular.woff2') format('woff2'),
         url('../fonts/IRANSansX-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'IRANSansX';
    src: url('../fonts/IRANSansX-Bold.woff2') format('woff2'),
         url('../fonts/IRANSansX-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'IRANSansX';
    src: url('../fonts/IRANSansX-Medium.woff2') format('woff2'),
         url('../fonts/IRANSansX-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
}

:root {
    --primary: #F7AD12;
    --secondary: #333333;
    --dark: #ffffff;
    --light: #000000;
    --gray: #f5f5f5;
    --gray-light: #e5e5e5;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

html {
    -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IRANSansX', sans-serif;
    background-color: var(--dark);
    color: var(--light);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--gray);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
}

.logo-section {
    text-align: center;
    margin-bottom: 30px;
}

.logo-section img {
    max-width: 150px;
    height: auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--secondary);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    background: var(--dark);
    color: var(--light);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(247, 173, 18, 0.1);
}

.field-hint {
    display: block;
    margin-top: 6px;
    color: var(--secondary);
    opacity: 0.75;
    font-size: 0.85rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.2;
}

.btn-primary {
    background: var(--primary);
    color: #000000;
}

.btn-primary:hover {
    background: #e69d0a;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--light);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: 40px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.sidebar {
    width: 280px;
    background: var(--gray);
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    padding: 20px;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    margin-bottom: 30px;
    text-align: center;
}

.sidebar-logo {
    max-width: 180px;
    height: auto;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 8px;
}

.nav-menu a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 12px 16px;
    color: var(--secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: var(--primary);
    color: #000000;
}

.main-content {
    margin-right: 280px;
    padding: 30px;
    min-height: 100vh;
    transition: margin 0.3s ease;
}

/* Mobile Menu Button - Professional Animated Hamburger */
.mobile-menu-btn {
    display: none;
    background: rgba(247, 173, 18, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(247, 173, 18, 0.3);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    z-index: 101;
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mobile-menu-btn:hover {
    background: rgba(230, 157, 10, 0.95);
    transform: scale(1.05);
}

.menu-icon {
    position: relative;
    display: block;
    width: 20px;
    height: 2px;
    background: #000000;
    margin: auto;
    transition: all 0.3s ease;
}

.menu-icon::before,
.menu-icon::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: #000000;
    transition: all 0.3s ease;
}

.menu-icon::before {
    top: -7px;
}

.menu-icon::after {
    top: 7px;
}

.mobile-menu-btn.open .menu-icon {
    background: transparent;
}

.mobile-menu-btn.open .menu-icon::before {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.open .menu-icon::after {
    transform: rotate(-45deg) translate(5px, -5px);
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.active {
    display: block;
    opacity: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    color: var(--primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: var(--secondary);
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--gray);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card h3 {
    color: var(--secondary);
    margin-bottom: 10px;
    font-size: 1rem;
}

.card .number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
}

.table-container {
    background: var(--gray);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--secondary);
    font-size: 14px;
}

table th,
table td {
    padding: 15px;
    text-align: right;
    white-space: nowrap;
}

table th {
    background: var(--gray-light);
    color: var(--primary);
    font-weight: 500;
}

table tr {
    border-bottom: 1px solid var(--gray-light);
}

table tr:hover {
    background: var(--gray-light);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.badge-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.narrow-form-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 30px;
}

.filter-section {
    background: var(--gray);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

#map {
    height: 500px;
    border-radius: 12px;
    margin-top: 20px;
}

.checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.checkbox-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
}

.image-upload-area {
    border: 2px dashed var(--gray-light);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.image-upload-area:hover {
    border-color: var(--primary);
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.image-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--gray);
    padding: 30px;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--light);
    font-size: 1.5rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.close-btn:hover {
    background: var(--gray-light);
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        padding: 20px;
        padding-top: 76px;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .overlay.active {
        display: block;
    }

    table {
        display: block;
        overflow-x: auto;
    }

    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .address-item, .phone-item {
        padding: 12px;
    }

    .address-item .filter-grid,
    .phone-item .filter-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .filter-grid > .form-group {
        width: 100% !important;
        grid-column: 1 / -1 !important;
    }

    .dashboard-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    #map {
        height: 350px;
    }

    .modal-content {
        max-width: 90vw;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .container,
    .main-content {
        padding: 16px;
        padding-top: 76px;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .card .number {
        font-size: 2rem;
    }

    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        max-width: 100vw;
        width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }
}

/* Card-style responsive tables for small screens: each row becomes a
   labeled card instead of forcing horizontal scrolling, which is both
   easier to read and easier to tap accurately. */
@media (max-width: 640px) {
    .table-wrapper table,
    .table-wrapper thead,
    .table-wrapper tbody,
    .table-wrapper th,
    .table-wrapper td,
    .table-wrapper tr {
        display: block;
        width: 100%;
    }

    .table-wrapper {
        overflow-x: visible;
        padding: 12px;
    }

    .table-wrapper thead {
        position: absolute;
        top: -9999px;
        right: -9999px;
    }

    .table-wrapper tr {
        margin-bottom: 14px;
        border: 1px solid var(--gray-light);
        border-radius: 12px;
        overflow: hidden;
        background: var(--dark);
    }

    .table-wrapper tr:last-child {
        margin-bottom: 0;
    }

    .table-wrapper td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 14px;
        min-height: 44px;
        text-align: left;
        white-space: normal;
        word-break: break-word;
        border: none;
        border-bottom: 1px solid var(--gray-light);
    }

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

    .table-wrapper td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--primary);
        flex-shrink: 0;
        text-align: right;
    }

    .table-wrapper td.log-data-cell {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-wrapper td.log-data-cell pre {
        max-width: 100% !important;
        width: 100%;
        margin-top: 6px;
        white-space: pre-wrap;
        word-break: break-word;
    }

    .table-wrapper td .action-buttons {
        justify-content: flex-end;
        width: 100%;
    }

    .action-buttons {
        width: 100%;
    }

    .action-buttons .btn,
    .action-buttons form {
        flex: 1 1 auto;
    }

    .action-buttons .btn {
        width: 100%;
    }

    #map {
        height: 280px;
    }

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

    .btn-block-mobile {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 85%;
        max-width: 300px;
    }

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

    .btn {
        padding: 10px 18px;
        font-size: 0.95rem;
    }

    .modal-content {
        padding: 20px;
    }

    .auth-card {
        padding: 24px 16px;
    }

    .logo-section img {
        max-width: 110px;
    }

    table th,
    table td {
        padding: 10px;
    }
}
