/* Custom styles for Curriculum Tracker */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
}

body {
    background-color: var(--light-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Dashboard Cards */
.class-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.class-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.year-group-section h3 {
    color: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* Progress Tracking Page */
.curriculum-container {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.block-header {
    background-color: #e9ecef;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.block-header:hover {
    background-color: #dee2e6;
}

.block-header h4 {
    margin: 0;
    color: #495057;
}

.topic-section {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 5px 5px 0;
}

.topic-section h5 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.objective-item {
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.objective-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.1);
}

.objective-item.completed {
    background-color: #d1e7dd;
    border-color: var(--success-color);
}

.objective-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.objective-date {
    width: 150px;
}

.objective-notes {
    min-height: 38px;
    resize: vertical;
}

/* Class Management */
.block-selector {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 1rem;
}

.block-checkbox-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--light-bg);
    border-radius: 5px;
}

.block-checkbox-item:hover {
    background: #e9ecef;
}

/* Reports */
.report-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.progress-stat {
    text-align: center;
    padding: 1rem;
}

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

.progress-stat .stat-label {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* Responsive Tables */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Loading Spinner */
.spinner-container {
    text-align: center;
    padding: 3rem;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
}

/* Buttons */
.btn {
    border-radius: 5px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Screenshots Section Specific Styles */
#screenshots {
    background-color: var(--light-bg);
}

#screenshotTabs .nav-link {
    border: 1px solid var(--border-color);
    background-color: white;
}
#screenshotTabs .nav-link.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.carousel-item img.carousel-screenshot {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
}
.carousel-item img.carousel-screenshot:hover {
    transform: scale(1.01);
}

.carousel-caption-custom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 40px;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    background-color: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 8px;
    max-width: 90%;
    margin: 0 auto;
    font-size: 0.9rem;
    display: block !important;
}

.carousel-caption-custom p {
    margin-bottom: 0;
}

.carousel-indicators-custom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.3) 70%, transparent);
    padding-top: 10px;
    padding-bottom: 5px;
    border-radius: 0 0 8px 8px;
}

.carousel-indicators-custom button {
    background-color: white;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.carousel-indicators-custom button.active {
    opacity: 1;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    padding: 15px;
}

/* Modal Styles for Full-size Carousel */
#screenshotModal .modal-content {
    background-color: transparent;
    border: none;
}

#screenshotModal .modal-dialog {
    max-width: 90vw;
}

#screenshotModal .modal-body {
    padding: 0;
    position: relative;
}

#screenshotModal .carousel-control-prev,
#screenshotModal .carousel-control-next {
    width: 5%;
}

#screenshotModal .carousel-control-prev-icon,
#screenshotModal .carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    padding: 15px;
}

#screenshotModal .carousel-caption-modal {
    position: absolute;
    bottom: 40px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    max-width: 80%;
    font-size: 1.1rem;
    text-align: center;
}
#screenshotModal .carousel-caption-modal p {
    margin-bottom: 0;
}

#screenshotModal .carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.3) 70%, transparent);
    padding-top: 10px;
    padding-bottom: 5px;
    border-radius: 8px;
}

#screenshotModal .carousel-indicators button {
    background-color: white;
    opacity: 0.7;
}

#screenshotModal .carousel-item img {
    max-height: 80vh;
    width: auto;
    margin: auto;
    display: block;
    object-fit: contain;
}



/* Print Styles */
@media print {
    .navbar, .btn, .no-print {
        display: none !important;
    }
    
    .curriculum-container {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* Enhanced Mobile Responsive Fixes - Add to styles.css */

/* MOBILE RESPONSIVE - Enhanced with higher specificity */
@media (max-width: 767.98px) {
    
    /* ===== GENERAL MOBILE UTILITIES ===== */
    
    /* Force vertical stacking for any flex container marked as mobile-stack */
    .mobile-stack,
    .d-flex.justify-content-between.align-items-center.my-4.flex-wrap.gap-2,
    .d-flex.align-items-center.gap-3,
    .d-flex.justify-content-between.align-items-center.mb-3.flex-wrap.gap-2 {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }
    
    .mobile-stack > *,
    .d-flex.justify-content-between.align-items-center.my-4.flex-wrap.gap-2 > *,
    .d-flex.align-items-center.gap-3 > *,
    .d-flex.justify-content-between.align-items-center.mb-3.flex-wrap.gap-2 > * {
        width: 100% !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* ===== BUTTON GROUPS MOBILE FIX ===== */
    
    .mobile-stack .btn-group,
    .btn-group,
    .d-flex .btn-group {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .mobile-stack .btn-group .btn,
    .btn-group .btn {
        flex: 1 !important;
        width: 100% !important;
        margin-bottom: 0.25rem !important;
        border-radius: 0.375rem !important; /* Restore rounded corners for stacked buttons */
    }
    
    /* Special handling for role="group" button groups that should stay horizontal */
    .btn-group[role="group"] {
        flex-direction: row !important;
    }
    
    .btn-group[role="group"] .btn {
        flex: 1 !important;
        margin-bottom: 0 !important;
    }
    
    /* ===== CLASS LOG SPECIFIC FIXES ===== */
    
    /* Fix the main header section in class-log.php */
    .d-flex.justify-content-between.align-items-center.mb-3.flex-wrap.gap-2 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    
    .d-flex.justify-content-between.align-items-center.mb-3.flex-wrap.gap-2 > div {
        width: 100% !important;
        text-align: center !important;
    }
    
    /* Fix filter row in class-log.php */
    .row.g-2.mb-3.mobile-stack {
        margin: 0 !important;
    }
    
    .row.g-2.mb-3.mobile-stack > * {
        width: 100% !important;
        padding: 0 !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Fix log card actions */
    .log-card .card-footer .btn-group {
        width: 100% !important;
        margin-top: 0.5rem !important;
    }
    
    .log-card .card-footer {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    /* ===== REPORTS.PHP SPECIFIC FIXES ===== */
    
    /* Fix the reports header container */
    .reports-header-container {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    
    .reports-header-container > div {
        width: 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }
    
    .reports-header-container h1,
    .reports-header-container h4 {
        text-align: center !important;
        margin-bottom: 1rem !important;
    }
    
    /* Fix subject dropdown and action buttons in reports */
    .reports-header-container .input-group,
    .reports-header-container .form-select,
    .reports-header-container .btn-group,
    .reports-header-container .btn,
    .reports-header-container form {
        width: 100% !important;
    }
    
    .reports-header-container .d-flex.align-items-center.flex-wrap.gap-3 {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    /* ===== FORM CONTROLS MOBILE FIX ===== */
    
    /* Force all form controls to full width on mobile */
    .form-select,
    .form-control,
    .input-group {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 0.5rem !important;
    }
    
    .input-group > * {
        width: auto !important;
        flex: 1 !important;
    }
    
    /* ===== NAVIGATION TAB FIXES ===== */
    
    /* Make navigation tabs scroll horizontally on mobile if needed */
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap !important;
        min-width: max-content !important;
    }
    
    /* ===== TABLE RESPONSIVE OVERRIDES ===== */
    
    /* Enhanced table-to-cards behavior */
    .table-to-cards {
        font-size: 0.9rem !important;
    }
    
    .table-to-cards td:before {
        font-size: 0.8rem !important;
        color: #6c757d !important;
    }
    
    /* ===== CARD AND CONTAINER SPACING ===== */
    
    .curriculum-container,
    .report-card,
    .card {
        margin-left: 0.5rem !important;
        margin-right: 0.5rem !important;
        padding: 1rem !important;
    }
    
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* ===== OBJECTIVE ITEMS MOBILE ENHANCEMENT ===== */
    
    /* Force mobile behavior for objective items with inline styles */
    .objective-item[style] {
        font-size: 0.85rem !important;
        padding: 0.5rem !important;
    }
    
    .objective-item[style] .row {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .objective-item[style] .row .col, 
    .objective-item[style] .row .col-auto,
    .objective-item[style] .row > * {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        margin-bottom: 0.5rem !important;
    }
    
    .objective-item[style] .objective-date,
    .objective-item[style] .objective-notes {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* ===== MODAL IMPROVEMENTS ===== */
    
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100vw - 1rem) !important;
    }
    
    .modal-content {
        border-radius: 0.5rem !important;
    }
    
    /* ===== ALERT AND INFO SECTIONS ===== */
    
    .alert {
        margin-left: 0.5rem !important;
        margin-right: 0.5rem !important;
        font-size: 0.9rem !important;
    }
    
    /* ===== PROGRESS STATS MOBILE ===== */
    
    .progress-stat {
        padding: 0.75rem !important;
        margin-bottom: 1rem !important;
    }
    
    .progress-stat .stat-number {
        font-size: 2rem !important;
    }
    
    /* ===== UTILITY CLASSES ===== */
    
    /* Hide elements not suited for mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Show elements only on mobile */
    .mobile-only {
        display: block !important;
    }
    
    /* Force text center on mobile for certain elements */
    .mobile-text-center {
        text-align: center !important;
    }
    
    /* ===== DEBUGGING HELPERS (remove in production) ===== */
    /*
    .mobile-stack {
        border: 2px solid red !important;
    }
    
    .mobile-stack > * {
        border: 1px solid blue !important;
    }
    */
}