/* Main CSS for Khateeb Planner */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #43a047;
    --accent-color: #ff9800;
    --warning-color: #f57c00;
    --danger-color: #e53935;
    --dark-color: #212121;
    --light-color: #f5f5f5;
    --text-color: #424242;
    --text-muted: #757575;
    --sidebar-bg: #ffffff;
    --sidebar-color: #424242;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 60px;
    --font-family: 'Noto Nastaliq Urdu', serif;
}

[data-theme="dark"] {
    --primary-color: #2196f3;
    --secondary-color: #4caf50;
    --accent-color: #ff9800;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --dark-color: #121212;
    --light-color: #333333;
    --text-color: #e0e0e0;
    --text-muted: #9e9e9e;
    --sidebar-bg: #1e1e1e;
    --sidebar-color: #e0e0e0;
    --card-bg: #1e1e1e;
    --border-color: #424242;
}

body {
    font-family: var(--font-family);
    background-color: #f8f9fa;
    color: var(--text-color);
    line-height: 1.7;
    direction: rtl;
    transition: background-color 0.3s ease;
}

/* Sidebar Styles */
.sidebar {
    background-color: #fff;
    box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.05);
    height: 100vh;
    position: fixed;
    z-index: 1000;
    width: var(--sidebar-width);
    overflow-y: auto;
    transition: all 0.3s;
}

.sidebar-header {
    background-color: var(--primary-color);
    color: #fff;
}

.user-profile {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: #495057;
    border-radius: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

.nav-link.active {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-link i {
    width: 24px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    margin-right: var(--sidebar-width);
    padding: 0.75rem;
    transition: all 0.3s;
    max-width: 1300px;
    margin-left: auto;
}

@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .main-content {
        margin-right: 0;
        width: 100%;
        padding: 1rem;
    }
    
    .sidebar {
        transform: translateX(280px);
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px !important;
        z-index: 1000;
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    body.sidebar-open {
        overflow: hidden;
    }
    
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.3);
        z-index: 999;
        display: none;
    }
    
    body.sidebar-open .sidebar-backdrop {
        display: block;
    }
    
    .toggle-sidebar-btn {
        display: block;
    }

    /* Adjust card layouts for tablets */
    .row {
        margin-right: -8px;
        margin-left: -8px;
    }

    .row > [class*="col-"] {
        padding-right: 8px;
        padding-left: 8px;
    }

    .card {
        margin-bottom: 1rem;
    }
}

@media (min-width: 992px) {
    .toggle-sidebar-btn {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        margin-bottom: 0;
    }
    
    .btn {
        padding: 0.375rem 1rem;
    }
    
    .hide-on-mobile {
        display: none !important;
    }
    
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
    }

    /* Adjust stats cards for mobile */
    .stats-number {
        font-size: 1.5rem;
    }

    .progress {
        height: 0.5rem;
    }

    /* Improve chart responsiveness */
    .chart-container {
        position: relative;
        height: 250px;
        width: 100%;
    }

    /* Adjust list items for mobile */
    .list-group-item {
        padding: 0.75rem;
    }

    .list-group-item .fw-bold {
        font-size: 0.9rem;
    }

    .list-group-item small {
        font-size: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    h2, .h2 {
        font-size: 1.35rem;
    }
    
    .col-form-label {
        margin-bottom: 0.25rem;
    }
    
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .btn-group-sm > .btn, .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Further adjustments for very small screens */
    .container-fluid {
        padding-right: 8px;
        padding-left: 8px;
    }

    .main-content {
        padding: 8px !important;
    }

    .stats-card {
        padding: 0.5rem;
    }

    .stats-number {
        font-size: 1.25rem;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.2em 0.4em;
    }

    /* Improve mobile menu toggle */
    .mobile-menu-toggle {
        width: 36px;
        height: 36px;
        top: 8px;
        right: 8px;
    }

    .mobile-menu-toggle i {
        font-size: 1.25rem;
    }
}

/* Card Styles */
.card {
    border: none;
    box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.75rem 1rem;
}

/* List Group Customization */
.list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

/* Button Customization */
.btn {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-success {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

/* Progress Bar Customization */
.progress {
    height: 0.6rem;
    border-radius: 0.25rem;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Special Urdu Typography Adjustments */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.5;
    font-weight: 700;
}

/* Dark Mode Toggle */
.theme-toggle {
    position: relative;
    display: inline-block;
}

#theme-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Animation for sidebar menu */
.nav-link i {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
}

.nav-link:hover i {
    transform: translateX(-3px);
}

/* Custom loader for page transitions */
.loader {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 3px solid var(--primary-color);
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Badge customization */
.badge {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Custom Chart tooltip styling */
.chart-tooltip {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-color);
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #f8f9fa;
}

body.dark-mode .card,
body.dark-mode .sidebar,
body.dark-mode .modal-content {
    background-color: #2a2a2a;
    color: #f8f9fa;
}

body.dark-mode .card-header,
body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    background-color: #333;
    border-color: #444;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #333;
    border-color: #444;
    color: #f8f9fa;
}

body.dark-mode .table {
    color: #f8f9fa;
}

body.dark-mode .table-hover tbody tr:hover {
    color: #f8f9fa;
    background-color: rgba(255, 255, 255, 0.075);
}

body.dark-mode .nav-tabs .nav-link.active {
    background-color: #2a2a2a;
    color: #f8f9fa;
    border-color: #444;
}

body.dark-mode .nav-tabs {
    border-color: #444;
}

body.dark-mode .text-muted {
    color: #adb5bd !important;
}

body.dark-mode .border {
    border-color: #444 !important;
}

body.dark-mode .sidebar .nav-link {
    color: #e9ecef;
}

body.dark-mode .sidebar .nav-link:hover,
body.dark-mode .sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .sidebar-header {
    background-color: #212529;
}

/* Print Styles */
@media print {
    .sidebar, .btn, .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-right: 0;
        padding: 0 !important;
    }
    
    body {
        background-color: #fff !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Additional Mobile Styles */
.mobile-menu-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1050;
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.mobile-menu-toggle i {
    font-size: 1.5rem;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 990;
    display: none;
    width: 100%;
    height: 100%;
}

body.sidebar-open .sidebar-backdrop {
    display: block;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(280px);
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px !important;
        z-index: 1000;
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 767.98px) {
    h5.card-title {
        font-size: 1rem;
    }
    
    .display-5 {
        font-size: calc(1.2rem + 1.5vw);
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .row > [class*="col-"] {
        padding-right: 8px;
        padding-left: 8px;
    }
    
    .row {
        margin-right: -8px;
        margin-left: -8px;
    }
}

@media (max-width: 575.98px) {
    .container-fluid, .container {
        padding-right: 12px;
        padding-left: 12px;
    }
    
    .main-content {
        padding: 12px !important;
    }
    
    .card-header {
        padding: 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .badge {
        padding: 0.25em 0.5em;
        font-size: 0.75em;
    }
    
    .list-group-item {
        padding: 0.5rem 0.75rem;
    }
    
    .fw-bold {
        font-size: 0.9rem;
    }
    
    .small, small {
        font-size: 0.75rem;
    }
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .chart-container {
        height: 250px;
    }
}

@media (max-width: 576px) {
    .chart-container {
        height: 200px;
    }
}

/* Report Page Styles */
.reports-page .card {
    transition: all 0.3s ease;
}

.reports-page .card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.reports-page .stats-card {
    text-align: center;
    padding: 0.75rem;
}

.reports-page .stats-card i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Table styles */
.table-responsive {
    overflow-x: auto;
}

@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    .chart-container {
        page-break-inside: avoid;
        height: 200px;
    }
}

/* Reports Page Specific Styles */
#monthlyProgressChart,
#activitiesDistributionChart,
#targetVsProgressChart,
#proportionChart {
    width: 100% !important;
    height: 100% !important;
}

.card-body canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Adjust grid spacing */
.row {
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}

.row > [class*="col-"] {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

/* Adjust stats cards */
.stats-card {
    padding: 0.75rem;
}

.stats-number {
    font-size: 1.75rem;
}

/* Adjust form elements */
.form-control {
    padding: 0.375rem 0.75rem;
    font-size: 0.95rem;
}

.form-label {
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

/* Adjust headings */
h1, .h1 { font-size: 1.65rem; }
h2, .h2 { font-size: 1.4rem; }
h3, .h3 { font-size: 1.2rem; }
h4, .h4 { font-size: 1.05rem; }
h5, .h5 { font-size: 0.95rem; }
h6, .h6 { font-size: 0.85rem; }

/* Adjust table spacing */
.table td, .table th {
    padding: 0.5rem;
    font-size: 0.95rem;
}

/* Adjust modal sizes */
.modal-dialog {
    margin: 0.5rem auto;
}

.modal-content {
    padding: 0.75rem;
} 