/* Custom theme overrides and additions */
:root {
    /* Set color variables for consistency */
    --primary-color: #2c3e50;
    --secondary-color: #1abc9c;
    --accent-color: #3498db;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
}

/* General Styles */
body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

.bg-primary-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
}

.card {
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Custom Dashboard Cards */
.stats-card {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-card .stats-value {
    font-size: 2.5rem;
    font-weight: bold;
}

.stats-card .stats-label {
    font-size: 1rem;
    opacity: 0.8;
}

/* Login Page */
.login-card {
    max-width: 400px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.brand-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.brand-logo h1 {
    font-size: 2rem;
    font-weight: 700;
}

/* Sidebar */
.sidebar {
    min-height: 100vh;
    transition: all 0.3s;
    width: 260px;
    position: fixed;
    z-index: 1000;
    right: 0;
    top: 0;
    bottom: 0;
}

.sidebar-link {
    padding: 0.75rem 1rem;
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-radius: 0.25rem;
    margin: 0.25rem 0;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-link i {
    margin-left: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Mobile Sidebar */
.sidebar-mobile {
    position: fixed;
    top: 0;
    right: -260px;
    width: 260px;
    height: 100%;
    z-index: 1050;
    background-color: var(--dark-color);
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-mobile.show {
    right: 0;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

.sidebar-backdrop.show {
    display: block;
}

/* Custom Table Styles */
.table-custom {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table-custom thead {
    background-color: var(--primary-color);
    color: white;
}

/* Responsive Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .table-responsive-sm {
        display: block;
        width: 100%;
    }
    
    .table-responsive-sm .table {
        min-width: 540px;
    }
}

/* Calendar Customization */
.fc-event {
    cursor: pointer;
    border-radius: 3px;
    padding: 3px;
}

.fc-day-today {
    background-color: rgba(var(--bs-primary-rgb), 0.1) !important;
}

/* Mobile Calendar View */
@media (max-width: 767.98px) {
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .fc .fc-toolbar-title {
        font-size: 1.25rem;
    }
    
    .fc .fc-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    .fc .fc-view-harness {
        height: 500px !important;
    }
}

/* Form Customization */
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    transform: scale(0.8) translateY(-0.5rem) translateX(0);
}

.form-group {
    margin-bottom: 1rem;
}

/* Mobile-friendly Forms */
@media (max-width: 767.98px) {
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-label {
        font-weight: 500;
    }
    
    .form-control {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    select.form-control {
        height: calc(1.5em + 1.5rem + 2px);
    }
    
    textarea.form-control {
        min-height: 100px;
    }
    
    .input-group > .form-control {
        min-height: 44px;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
    }
}

/* Whatsapp button */
.btn-whatsapp {
    background-color: #25D366;
    color: white;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
    color: white;
}

/* Phone button */
.btn-phone {
    background-color: #3498db;
    color: white;
}

.btn-phone:hover {
    background-color: #2980b9;
    color: white;
}

/* Action Buttons for Mobile */
@media (max-width: 767.98px) {
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .action-buttons-mobile {
        display: flex;
        justify-content: space-between;
        margin-top: 0.5rem;
    }
    
    .action-buttons-mobile .btn {
        flex: 1;
        margin: 0 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile Navigation Footer */
.mobile-nav-footer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--primary-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    height: 60px;
}

.mobile-nav-footer .nav-item {
    text-align: center;
    flex: 1;
}

.mobile-nav-footer .nav-link {
    padding: 0.5rem 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.7rem;
    transition: all 0.2s ease;
}

.mobile-nav-footer .nav-link i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.mobile-nav-footer .nav-link.active {
    color: white;
    font-weight: 500;
}

.mobile-nav-footer .nav-link:hover {
    color: white;
}

/* Mobile Menu Modal */
#mobileMenuModal .modal-header {
    border-radius: 0;
}

#mobileMenuModal .list-group-item {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 0.75rem 1rem;
}

#mobileMenuModal .list-group-item i {
    min-width: 24px;
}

#mobileMenuModal .list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Mobile Form Buttons */
@media (max-width: 767.98px) {
    .form-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-buttons .btn {
        width: 100%;
    }
    
    /* For forms that have multiple buttons side by side */
    .form-inline-buttons {
        display: flex;
        gap: 0.5rem;
    }
    
    .form-inline-buttons .btn {
        flex: 1;
    }
}

@media (max-width: 767.98px) {
    .mobile-nav-footer {
        display: flex;
    }
    
    body {
        padding-bottom: 60px;
    }
    
    .sidebar {
        display: none;
    }
    
    .content-wrapper {
        padding-bottom: 1rem;
    }
    
    main {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        margin-left: 0 !important;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .table td, .table th {
        padding: 0.5rem;
    }

    /* Improved heading display for mobile */
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    h3, .h3 {
        font-size: 1.25rem;
    }
    
    /* For tables with action buttons */
    .table td:last-child {
        min-width: 100px;
    }
    
    /* Make form inputs easier to tap */
    input, select, textarea, button {
        font-size: 16px !important; /* Prevents zooming on iOS */
    }
}

/* Small Phone Display */
@media (max-width: 375px) {
    .mobile-nav-footer .nav-link {
        font-size: 0.65rem;
    }
    
    .mobile-nav-footer .nav-link i {
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .table td, .table th {
        padding: 0.4rem;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        background-color: white !important;
    }
    
    .container {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    
    .table {
        width: 100% !important;
    }
}
