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

@font-face {
    font-family: 'Vazir';
    src: url('../src/fonts/Vazir.eot');
    src: url('../src/fonts/Vazir-Medium.woff2') format('woff2'),
            url('../src/fonts/Vazir-Medium.woff') format('woff');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Vazir';
    src: url('../src/fonts/Vazir.eot');
    src: url('../src/fonts/Vazir.woff2') format('woff2'),
            url('../src/fonts/Vazir.woff') format('woff');
    font-weight: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazir';
    src: url('../src/fonts/Vazir-Bold.eot');
    src: url('../src/fonts/Vazir-Bold.woff2') format('woff2'),
            url('../src/fonts/Vazir-Bold.woff') format('woff');
    font-weight: bold;
    font-display: swap;
}
@font-face {
    font-family: 'TitrCircle';
    src: url('../src/fonts/Titr-Circle.otf');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'TitrLine';
    src: url('../src/fonts/Titr-Line.otf');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'TitrRectangle';
    src: url('../src/fonts/Titr-Rectangle.otf');
    font-weight: 500;
    font-display: swap;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazir', 'Vazirmatn', Tahoma, sans-serif;
}

body {
    font-family: 'Vazir', 'Vazirmatn', Tahoma, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    padding: 20px;
    direction: rtl;
    min-height: 100vh;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 40px;
    border-radius: 32px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.admin-header h1 {
    font-family: 'TitrLine', 'Vazir', Tahoma, sans-serif;
    font-size: 2.2em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff, #e94560);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.admin-header a {
    color: #e94560;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.admin-header a:hover {
    color: #ff6b81;
}

.alert {
    padding: 18px 25px;
    border-radius: 20px;
    margin-bottom: 25px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-right: 5px solid #28a745;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-right: 5px solid #17a2b8;
}

.card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 32px;
    padding: 35px;
    margin-bottom: 35px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(255,255,255,0.2);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}

.card h2 {
    color: #1a1a2e;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 3px solid #e94560;
    display: inline-block;
    font-size: 1.6em;
}

.card h2 i {
    margin-left: 10px;
    color: #e94560;
}

.upload-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.form-group label i {
    margin-left: 8px;
    color: #e94560;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-family: 'Vazir', 'Vazirmatn', sans-serif;
    font-size: 14px;
    transition: all 0.3s;
    background: #f8f9fa;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #e94560;
    box-shadow: 0 0 0 4px rgba(233,69,96,0.1);
    background: white;
}

.form-group input[type="file"] {
    padding: 12px;
    background: #f8f9fa;
}

.btn-upload, .btn-primary, .btn-filter {
    background: linear-gradient(135deg, #e94560, #c62a47);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-family: 'Vazir', 'Vazirmatn', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-upload:hover, .btn-primary:hover, .btn-filter:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(233,69,96,0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-section {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 24px;
    padding: 25px;
    margin-bottom: 30px;
}

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

.filter-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.btn-reset {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.patient-section {
    margin-bottom: 30px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.3s;
}

.patient-section:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.patient-header {
    background: linear-gradient(135deg, #16213e, #0f3460);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.patient-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: baseline;
}

.national-code {
    font-size: 1.2em;
    font-weight: bold;
    font-family: monospace;
    letter-spacing: 1px;
}

.patient-name {
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.9em;
}

.xray-count {
    background: #e94560;
    padding: 6px 15px;
    border-radius: 30px;
    font-size: 0.85em;
    font-weight: 500;
}

.edit-patient-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 18px;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Vazir', 'Vazirmatn', sans-serif;
    transition: all 0.3s;
}

.edit-patient-btn:hover {
    background: rgba(255,255,255,0.3);
}

.admin-xray-list {
    padding: 25px;
    background: white;
}

.admin-xray-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    transition: background 0.3s;
}

.admin-xray-item:hover {
    background: #f8f9fa;
}

.xray-preview img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.xray-preview img:hover {
    transform: scale(1.05);
}

.xray-info {
    flex: 1;
}

.xray-caption {
    font-weight: 600;
    margin-bottom: 5px;
    color: #1a1a2e;
}

.xray-date {
    color: #888;
    font-size: 0.85em;
}

.xray-actions {
    display: flex;
    gap: 12px;
}

.btn-edit, .btn-delete, .btn-save, .btn-cancel {
    padding: 8px 18px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Vazir', 'Vazirmatn', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.btn-edit {
    background: #ffc107;
    color: #333;
}

.btn-edit:hover {
    background: #e0a800;
    transform: translateY(-2px);
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-save {
    background: #28a745;
    color: white;
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.edit-form {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    margin: 0 18px 18px 18px;
    border-radius: 20px;
    display: none;
}

.edit-form form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.edit-form input {
    flex: 1;
    min-width: 180px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 14px;
    font-family: 'Vazir', 'Vazirmatn', sans-serif;
}

.edit-form button {
    margin: 0;
}

.patient-meta-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.patient-meta-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 32px;
    padding: 35px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-content h3 {
    margin-bottom: 25px;
    color: #1a1a2e;
}

.modal-close {
    position: absolute;
    top: 20px;
    left: 25px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #e94560;
}

.empty-state {
    text-align: center;
    padding: 60px;
    color: #999;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.info-box {
    background: linear-gradient(135deg, #e8f4ff, #d4e8ff);
    border-radius: 24px;
    padding: 25px;
    margin-top: 20px;
}

.info-box h3 {
    color: #16213e;
    margin-bottom: 15px;
}

.info-box ul {
    list-style: none;
    padding-right: 20px;
}

.info-box li {
    margin-bottom: 10px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-box code {
    background: #fff;
    padding: 4px 10px;
    border-radius: 8px;
    font-family: monospace;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 24px;
    text-align: center;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 768px) {
    body { padding: 15px; }
    .card { padding: 20px; }
    .admin-header { padding: 25px; }
    .admin-xray-item { flex-direction: column; text-align: center; }
    .xray-actions { justify-content: center; }
    .filter-grid { grid-template-columns: 1fr; }
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input-wrapper input[type="file"] {
    padding: 40px 20px;
    border: 2px dashed #ccc;
    background: #fafafa;
    cursor: pointer;
}

.file-input-wrapper input[type="file"]:hover {
    border-color: #e94560;
    background: #fff;
}

.persian-datepicker-container {
    width: 100%;
}

.persian-datepicker-container .persian-datepicker-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-family: 'Vazir', 'Vazirmatn', sans-serif;
    font-size: 14px;
}

.sort-link {
    color: #667eea;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 15px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.sort-link:hover {
    background: rgba(102,126,234,0.1);
}

.sort-link.active {
    background: #667eea;
    color: white;
}

@media (max-width: 768px) {
    .appointment-table {
        font-size: 12px;
    }
    .appointment-table th,
    .appointment-table td {
        padding: 8px;
    }
    .description-cell {
        max-width: 150px;
    }
}

.attachment-btn i {
    flex-shrink: 0;
}

.attachment-btn small {
    color: #666;
    font-size: 0.7em;
}

.attachment-btn:hover small {
    color: rgba(255,255,255,0.8);
}

/* Layout with Sidebar */
.app-layout {
    display: flex;
    min-height: 100vh;
    gap: 0;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f0c29 0%, #1a1a3e 100%);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    margin-left: 20px;
    padding: 25px 0;
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    text-align: center;
    padding: 20px 20px 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.sidebar-logo i {
    font-size: 48px;
    color: #e94560;
    margin-bottom: 10px;
}

.sidebar-logo h3 {
    color: white;
    font-size: 1.2em;
}

.sidebar-logo p {
    color: rgba(255,255,255,0.6);
    font-size: 0.8em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 15px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 16px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-item i {
    width: 24px;
    font-size: 1.2em;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(-5px);
}

.nav-item.active {
    background: linear-gradient(135deg, #e94560, #c62a47);
    color: white;
    box-shadow: 0 5px 15px rgba(233,69,96,0.3);
}

.nav-badge {
    margin-right: auto;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75em;
}

.sidebar-footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 20px;
}

.sidebar-footer a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-x: auto;
}

/* Sortable Table Headers */
.sortable-header {
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.sortable-header:hover {
    background: rgba(255,255,255,0.15);
}

.sortable-header i {
    transition: opacity 0.2s;
}

.sortable-header:hover i {
    opacity: 1 !important;
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    background: #f8f9fa;
    transition: all 0.3s;
    border: 1px solid #e0e0e0;
}

.pagination a:hover {
    background: #e94560;
    color: white;
    border-color: #e94560;
}

.pagination .active {
    background: linear-gradient(135deg, #e94560, #c62a47);
    color: white;
    border-color: #e94560;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: flex-end;
}

.per-page-selector select {
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid #ddd;
    font-family: 'Vazir', 'Vazirmatn', sans-serif;
}

/* Sidebar Responsive */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
        margin-bottom: 20px;
        margin-left: 0;
        top: 0;
    }
    .sidebar-footer {
        position: relative;
        bottom: auto;
        margin-top: 20px;
    }
}

/* Compact table for radiographies */
.radiographies-table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

th {
    color: white;
}

thead {
    background: linear-gradient(135deg, #16213e, #0f3460);
}

.thumbnail-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

/* Appointment Table Styles */
.appointment-table {
    width: 100%;
    border-collapse: collapse;
    direction: rtl;
}


.appointment-table thead {
    background: linear-gradient(135deg, #16213e, #0f3460);
}

.attachments-cell {
    max-width: 250px;
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-btn {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
    font-size: 0.75em;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-btn:hover {
    box-shadow: 0 5px 15px rgba(79,172,254,0.3);
    transform: translateY(-2px);
}

.description-cell {
    max-width: 250px;
    word-wrap: break-word;
    font-size: 0.85em;
}