/* admin.css - Premium Dashboard Styles for Maktabty */

:root {
    --bg-dark-sidebar: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #3b82f6;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --border-color: #f1f5f9;
}

/* Layout */
.dashboard-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    margin-top: 85px;
    margin-bottom: 30px;
    align-items: start;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 2rem !important;
}

.navbar .nav-container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 2rem !important;
}

/* Collapsible Sidebar States */
.dashboard-container.sidebar-collapsed {
    grid-template-columns: 1fr !important;
}

.dashboard-container.sidebar-collapsed .dashboard-sidebar {
    display: none !important;
}

/* Sidebar Styling */
.dashboard-sidebar {
    background: var(--bg-dark-sidebar);
    color: #fff;
    border-radius: 12px;
    padding: 1rem 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.1);
    position: sticky;
    top: 90px;
}

.dashboard-sidebar .user-profile-summary {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-sidebar .user-profile-summary .avatar {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 0.75rem;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.dashboard-sidebar .user-profile-summary h3 {
    margin: 0 0 0.2rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
}

.dashboard-sidebar .user-profile-summary p {
    margin: 0;
    color: #64748b;
    font-size: 0.8rem;
    word-break: break-all;
}

.dashboard-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dashboard-nav .tab-btn {
    background: transparent;
    border: none;
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Outfit', sans-serif;
    width: 100%;
}

.dashboard-nav .tab-btn i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    transition: transform 0.25s ease;
}

.dashboard-nav .tab-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}

.dashboard-nav .tab-btn:hover i {
    transform: translateX(3px);
}

.dashboard-nav .tab-btn.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.dashboard-nav .tab-btn.active i {
    color: #fff;
}

.dashboard-nav .tab-btn.text-danger {
    color: #f87171;
    margin-top: 1rem;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.dashboard-nav .tab-btn.text-danger:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

/* Dashboard Content */
.dashboard-content {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
    min-height: 500px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Collapsible Sidebar Toggle Bar */
.dashboard-header-bar {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.toggle-sidebar-btn {
    background: #f1f5f9;
    border: none;
    color: #475569;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.toggle-sidebar-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.tab-content {
    display: none;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
    display: block;
}

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

.tab-content h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #0f172a;
    font-size: 1.4rem;
    font-weight: 800;
}

/* Stats Dashboard Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    padding: 1.25rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    transition: background 0.3s;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08);
}

.stat-card.users-card:hover::after { background: var(--primary-color); }
.stat-card.admins-card:hover::after { background: #10b981; }
.stat-card.books-card:hover::after { background: #3b82f6; }
.stat-card.categories-card:hover::after { background: #8b5cf6; }

.stat-card .icon-wrapper {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    transition: transform 0.3s;
}

.stat-card:hover .icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

.stat-card h4 {
    margin: 0;
    font-size: 2rem;
    color: #0f172a;
    font-weight: 800;
}

.stat-card p {
    margin: 0.5rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Filters & Table controls */
.table-header-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1.25rem;
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.search-filter-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1;
}

.control-search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 380px;
}

.control-search-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.control-search-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
}

.control-search-wrapper input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.select-filter {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.select-filter:focus {
    border-color: #3b82f6;
}

.btn-header-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    color: #fff;
    font-family: inherit;
}

.btn-header-action.btn-add {
    background: #10b981;
}
.btn-header-action.btn-add:hover {
    background: #059669;
    transform: translateY(-1px);
}
.btn-header-action.btn-refresh {
    background: #3b82f6;
}
.btn-header-action.btn-refresh:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Modern Tables */
.admin-table-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.01);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.admin-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.admin-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background 0.15s;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

.role-badge.admin {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.role-badge.user {
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
}

.grade-badge {
    text-transform: capitalize;
    font-size: 0.8rem;
    font-weight: 500;
    background: #f1f5f9;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Action buttons in Table */
.btn-table-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.btn-table-action.edit-btn {
    background: #e0f2fe;
    color: #0369a1;
    margin-right: 0.35rem;
}

.btn-table-action.edit-btn:hover {
    background: #bae6fd;
    color: #075985;
}

.btn-table-action.role-btn {
    background: #f1f5f9;
    color: #475569;
    margin-right: 0.35rem;
}

.btn-table-action.role-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-table-action.delete-btn {
    background: #fee2e2;
    color: #ef4444;
}

.btn-table-action.delete-btn:hover {
    background: #fecaca;
    color: #dc2626;
}

.btn-table-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modals Overlay & Modals styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-modal {
    background: #fff;
    padding: 2.5rem;
    border-radius: 20px;
    width: 92%;
    max-width: 520px;
    position: relative;
    transform: scale(0.95) translateY(15px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .custom-modal {
    transform: scale(1) translateY(0);
}

.custom-modal.modal-narrow {
    max-width: 400px;
    text-align: center;
}

.modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 1.25rem;
}

.modal-icon.danger-icon {
    background: #fee2e2;
    color: #ef4444;
}

.modal-icon.info-icon {
    background: #dbeafe;
    color: #2563eb;
}

.custom-modal h3 {
    margin: 0 0 0.5rem;
    color: #0f172a;
    font-size: 1.4rem;
    font-weight: 700;
}

.custom-modal p {
    margin: 0 0 1.5rem;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Forms in Modals */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media(max-width: 480px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 600;
    color: #334155;
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fafafa;
    font-family: inherit;
    transition: all 0.25s;
    outline: none;
}

.form-input:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:disabled {
    background: #e2e8f0;
    color: #64748b;
    cursor: not-allowed;
}

.form-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    color: #334155;
    font-size: 0.9rem;
}

.form-checkbox-label input {
    width: 17px;
    height: 17px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.75rem;
}

.modal-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

.btn-confirm {
    background: #3b82f6;
    color: #fff;
}

.btn-confirm:hover {
    background: #1d4ed8;
}

.btn-confirm.btn-danger-confirm {
    background: #ef4444;
}

.btn-confirm.btn-danger-confirm:hover {
    background: #b91c1c;
}

/* System Status logs preview (on overview page) */
.system-status-box {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fafafa;
}

.system-status-box h4 {
    margin: 0 0 1rem 0;
    color: #0f172a;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.system-status-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.status-item {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.status-item span.label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.status-item span.value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Toast Notifications Container */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    width: 90%;
}

.toast-message {
    background: #fff;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-message.closing {
    animation: toastSlideOut 0.25s ease forwards;
}

@keyframes toastSlideOut {
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.toast-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
}

.toast-message.toast-success::before { background: #10b981; }
.toast-message.toast-error::before { background: #ef4444; }
.toast-message.toast-warning::before { background: #f59e0b; }
.toast-message.toast-info::before { background: #3b82f6; }

.toast-icon {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
}

.toast-success .toast-icon { color: #10b981; }
.toast-error .toast-icon { color: #ef4444; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon { color: #3b82f6; }

.toast-content {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #94a3b8;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.toast-close:hover {
    color: #475569;
}

/* Empty or Error state design */
.empty-table-state {
    text-align: center;
    padding: 3.5rem 2rem;
    color: #64748b;
}

.empty-table-state i {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.empty-table-state p.title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #334155;
    margin: 0 0 0.25rem 0;
}

.empty-table-state p.subtitle {
    font-size: 0.875rem;
    margin: 0;
}

.empty-table-state button {
    margin-top: 1.25rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: #3b82f6;
    color: #fff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

/* Access Denied overlay overlay */
.access-denied-container {
    text-align: center;
    padding: 5rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.access-denied-container i {
    font-size: 4.5rem;
    color: #ef4444;
    margin-bottom: 1.5rem;
}

.access-denied-container h2 {
    font-size: 1.8rem;
    color: #0f172a;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.access-denied-container p {
    color: #64748b;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.access-denied-container .btn {
    text-decoration: none;
    padding: 0.75rem 2rem;
    background: #3b82f6;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.2);
}

.access-denied-container .btn:hover {
    background: #2563eb;
}

/* Responsive sidebars */
@media (max-width: 992px) {
    .dashboard-container {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        margin-top: 65px !important;
        padding: 0 1rem !important;
    }
    
    .dashboard-sidebar {
        position: relative;
        top: 0;
    }
}

/* Side Panel / Sliding Drawer Override */
.side-panel-overlay {
    justify-content: flex-end !important;
    align-items: stretch !important;
}

.side-panel-overlay .side-panel {
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 20px 0 0 20px !important;
    width: 100% !important;
    max-width: 480px !important;
    margin: 0 !important;
    transform: translateX(100%) !important;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: -10px 0 30px rgba(15, 23, 42, 0.15) !important;
    display: flex !important;
    flex-direction: column !important;
}

.modal-overlay.active.side-panel-overlay .side-panel {
    transform: translateX(0) !important;
}

/* Stacked Mobile Tables */
@media (max-width: 768px) {
    .admin-table, 
    .admin-table thead, 
    .admin-table tbody, 
    .admin-table th, 
    .admin-table td, 
    .admin-table tr {
        display: block !important;
    }
    
    .admin-table thead {
        display: none !important; /* Hide headers */
    }
    
    .admin-table tbody tr {
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 1.25rem;
        padding: 1.25rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.01);
    }
    
    .admin-table tbody tr:hover {
        background: #f8fafc;
        border-color: #cbd5e1;
    }
    
    .admin-table td {
        padding: 0.6rem 0 !important;
        border: none !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        text-align: right !important;
        font-size: 0.9rem !important;
    }
    
    /* Prepend label to td on mobile */
    .admin-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #475569;
        text-align: left;
        margin-right: 1rem;
    }
    
    .admin-table td:last-child {
        border-top: 1px dashed #e2e8f0 !important;
        padding-top: 0.85rem !important;
        margin-top: 0.5rem !important;
        justify-content: center !important;
        text-align: center !important;
        display: flex !important;
    }
}

/* Copy buttons styles */
.btn-copy-mini {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    margin: 0 4px;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.btn-copy-mini:hover {
    color: #3b82f6;
    background: #f1f5f9;
}

.btn-copy-mini:active {
    transform: scale(0.9);
}

/* Table Cell Class Styling and Sizing overrides */
.order-id-cell {
    font-family: monospace;
    color: #64748b;
    font-size: 0.95em !important;
    font-weight: 600;
}

.customer-email, .customer-tel {
    font-size: 0.8em;
    color: #64748b;
}

.order-items-cell, .order-address-cell {
    line-height: 1.4;
    font-size: 0.95em;
}

.order-total-cell {
    font-weight: 600;
    color: #3b82f6;
}

.order-date-cell {
    color: #64748b;
    font-size: 0.95em;
}

/* WhatsApp action button styling */
.btn-table-action.whatsapp-btn {
    background: #25d366;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5em 0.8em;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    border: none;
    cursor: pointer;
    vertical-align: middle;
}

.btn-table-action.whatsapp-btn:hover {
    background: #128c7e;
    color: white;
}

.btn-table-action.whatsapp-btn i {
    font-size: 1.1em;
    margin-right: 3px;
}

/* Standardized responsive button and status select sizing */
.btn-table-action {
    padding: 0.5em 0.8em;
    font-size: 0.95em;
}

.order-status-select {
    padding: 0.45em !important;
    font-size: 0.95em !important;
    width: 100%;
    min-width: 110px;
}

/* Responsive Table Content Sizing Overrides */
@media (min-width: 1400px) {
    .admin-table {
        font-size: 0.95rem; /* Larger font size on very large viewports */
    }
    .admin-table th, 
    .admin-table td {
        padding: 0.8rem 1rem; /* More generous cell padding */
    }
}

@media (max-width: 1200px) and (min-width: 769px) {
    .admin-table {
        font-size: 0.8rem; /* Smaller text size on mid-size screens */
    }
    .admin-table th, 
    .admin-table td {
        padding: 0.45rem 0.5rem; /* Tighter padding to save space */
    }
    .order-status-select {
        min-width: 90px;
    }
}

/* Show inline actions on desktop, hide dropdown actions */
.inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-actions {
    display: none !important;
}

/* Responsive Action Buttons visibility */
@media (max-width: 1200px) {
    .inline-actions {
        display: none !important;
    }
    .dropdown-actions {
        display: inline-block !important;
    }
}

/* Table actions dropdown styling */
.table-actions-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.dropdown-trigger-btn:hover {
    background: #e2e8f0;
}

.dropdown-menu-content {
    display: none;
    position: absolute;
    right: 0; /* Align dropdown to the right edge */
    top: 100%;
    margin-top: 0.25rem;
    background: #fff;
    min-width: 145px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    z-index: 100;
    overflow: hidden;
    animation: dropdownFadeIn 0.2s ease;
}

/* For RTL alignment support */
html[lang="ar"] .dropdown-menu-content {
    right: auto;
    left: 0;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-actions-dropdown.active .dropdown-menu-content {
    display: flex;
    flex-direction: column;
}

.dropdown-menu-item {
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    box-sizing: border-box;
}

html[lang="ar"] .dropdown-menu-item {
    text-align: right;
}

.dropdown-menu-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.dropdown-menu-item.whatsapp-item:hover {
    background: rgba(37, 211, 102, 0.08);
}

.dropdown-menu-item.delete-btn {
    color: #ef4444;
}

.dropdown-menu-item.delete-btn:hover {
    background: #fee2e2;
    color: #b91c1c;
}

/* Mobile specific action dropdown button optimizations */
@media (max-width: 768px) {
    /* Hide the Actions td prefix label completely to avoid redundancy */
    .admin-table td:last-child::before {
        display: none !important;
    }
    
    /* Center the actions cell content itself (the dropdown button) */
    .admin-table td:last-child {
        justify-content: center !important;
        text-align: center !important;
        display: flex !important;
        padding-top: 1rem !important;
    }
    
    /* Hide the text label inside the dropdown button to make it a clean, circular action toggle */
    .actions-btn-text {
        display: none !important;
    }
    
    .dropdown-trigger-btn {
        padding: 0 !important;
        border-radius: 50% !important;
        width: 40px !important;
        height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    }
    
    .dropdown-trigger-btn i {
        font-size: 1.15rem !important;
        margin: 0 !important;
    }

    /* Position the dropdown menu nicely relative to the centered button */
    .table-actions-dropdown .dropdown-menu-content {
        right: 50% !important;
        transform: translateX(50%) !important;
        top: 100% !important;
        margin-top: 0.5rem !important;
    }
    
    html[lang="ar"] .table-actions-dropdown .dropdown-menu-content {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
    }

    /* Clean wrapping of elements inside td on mobile */
    .admin-table td > span,
    .admin-table td > select,
    .customer-info-wrapper,
    .address-info-wrapper,
    .price-info-wrapper,
    .grade-subject-wrapper {
        max-width: 65% !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        text-align: right !important;
        box-sizing: border-box !important;
    }

    .customer-info-wrapper,
    .address-info-wrapper,
    .price-info-wrapper,
    .grade-subject-wrapper {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 0.25rem !important;
    }
    
    .customer-email, .customer-tel {
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
    }

    /* Prevent overflow on the table-container scroll wrapper */
    .admin-table-container > div {
        overflow-x: visible !important;
    }
    
    /* Make the button row wrap responsive */
    .header-control-buttons {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    .header-control-buttons .btn-header-action {
        flex: 1 1 calc(50% - 0.25rem) !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
    .header-control-buttons .btn-header-action:only-child {
        flex: 1 1 100% !important;
    }

    /* Responsive filter controls */
    .table-header-control {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }
    .search-filter-group {
        width: 100% !important;
    }
    .control-search-wrapper {
        min-width: 100% !important;
        max-width: 100% !important;
    }
    .select-filter {
        flex: 1 1 calc(50% - 0.375rem) !important;
        min-width: 0 !important;
    }
}

@media (max-width: 480px) {
    .custom-modal {
        padding: 1.5rem !important;
    }
}

/* Order Receipt Action Buttons */
.btn-table-action.receipt-btn {
    background: #faf5ff;
    color: #7c3aed;
    margin-right: 0.35rem;
}

.btn-table-action.receipt-btn:hover {
    background: #f3e8ff;
    color: #6d28d9;
}

.dropdown-menu-item.receipt-item:hover {
    background: rgba(124, 58, 237, 0.08);
}

/* Printable Receipt Style */
.receipt-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    color: #1e293b;
    font-family: 'Outfit', 'Cairo', sans-serif;
    box-sizing: border-box;
}

.receipt-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.receipt-logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: #7c3aed;
    margin-bottom: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.receipt-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.receipt-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1.25rem;
    border: 1px solid #f1f5f9;
}

.info-item {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
}

.info-label {
    color: #64748b;
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.info-val {
    color: #0f172a;
    font-weight: 600;
}

.font-mono {
    font-family: monospace;
}

.receipt-divider {
    border-top: 2px dashed #e2e8f0;
    margin: 1.25rem 0;
}

.receipt-customer-details {
    font-size: 0.85rem;
    line-height: 1.5;
}

.section-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.35rem;
}

.detail-row {
    margin-bottom: 0.4rem;
}

.detail-row strong {
    color: #475569;
    font-weight: 600;
}

.receipt-items-section {
    font-size: 0.85rem;
}

.receipt-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.receipt-items-table th {
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.25rem;
    font-size: 0.8rem;
}

.receipt-items-table td {
    padding: 0.6rem 0.25rem;
    border-bottom: 1px dashed #f1f5f9;
}

.receipt-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #0f172a;
    margin-top: 1rem;
}

.total-amount {
    color: #7c3aed;
}

.receipt-footer {
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 1.5rem;
    line-height: 1.4;
}

.receipt-footer p {
    margin: 0.2rem 0;
}

.receipt-footer-url {
    font-weight: 600;
    color: #7c3aed;
    margin-top: 0.5rem;
}
