/* ============================================================
   All Adaptiv - Adaptive Management Platform
   Mobile-first CSS
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --primary-color: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --accent-color: #06b6d4;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
}

/* Bootstrap primary color override to match brand */
.bg-primary { background-color: var(--primary-color) !important; }
.btn-primary { background-color: var(--primary-color) !important; border-color: var(--primary-color) !important; }
.btn-primary:hover { background-color: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }
.btn-primary:focus { box-shadow: 0 0 0 0.25rem rgba(13, 148, 136, 0.25) !important; }
.btn-outline-primary { color: var(--primary-color) !important; border-color: var(--primary-color) !important; }
.btn-outline-primary:hover { background-color: var(--primary-color) !important; color: #fff !important; }
.text-primary { color: var(--primary-color) !important; }
.border-primary { border-color: var(--primary-color) !important; }
a { color: var(--primary-color); }
a:hover { color: var(--primary-dark); }

/* ============================================================
   BASE
   ============================================================ */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    padding: 0;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
    background: linear-gradient(135deg, #0f172a 0%, #134e4a 40%, #0c4a6e 100%);
    background-image: url('../images/login-bg.svg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 1rem;
}

.login-card {
    border-radius: 1rem;
    border: none;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.97);
}

.login-logo {
    height: 56px;
    width: auto;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
    background: var(--sidebar-bg) !important;
}

.sidebar-nav .nav-link {
    padding: 0.6rem 1.25rem;
    color: #cbd5e1 !important;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff !important;
    border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    border-left-color: var(--primary-color);
}

.nav-section-header {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #64748b !important;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
@media (min-width: 992px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

@media (max-width: 991.98px) {
    .main-content {
        padding-top: 56px;
    }
}

.content-wrapper {
    min-height: calc(100vh - 120px);
}

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.dashboard-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    cursor: pointer;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

.dashboard-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* ============================================================
   PIPELINE VISUALIZATION (Prospect Status)
   ============================================================ */
.pipeline-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 80px;
}

.pipeline-step::before {
    content: '';
    position: absolute;
    top: 14px;
    left: -50%;
    width: 100%;
    height: 2px;
    background-color: #e2e8f0;
    z-index: 0;
}

.pipeline-step:first-child::before {
    display: none;
}

.pipeline-step.completed::before {
    background-color: #22c55e;
}

.pipeline-step.active::before {
    background-color: var(--primary-color);
}

.pipeline-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: white;
    z-index: 1;
    margin-bottom: 0.25rem;
}

.pipeline-step.completed .pipeline-circle {
    background-color: #22c55e;
}

.pipeline-step.active .pipeline-circle {
    background-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.2);
}

.pipeline-step small {
    font-size: 0.65rem;
    color: #64748b;
    text-align: center;
}

.pipeline-step.active small {
    color: var(--primary-color);
    font-weight: 600;
}

/* ============================================================
   REGISTRATION STEPS
   ============================================================ */
.registration-steps {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.registration-steps .step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

.registration-steps .step span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.registration-steps .step.active {
    color: var(--primary-color);
    font-weight: 600;
}

.registration-steps .step.active span {
    background-color: var(--primary-color);
    color: white;
}

/* ============================================================
   CARDS & TABLES
   ============================================================ */
.card {
    border-radius: 0.75rem;
}

.card-header {
    border-radius: 0.75rem 0.75rem 0 0 !important;
}

.table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
}

.table td {
    vertical-align: middle;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #374151;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.15);
}

/* ============================================================
   EXERCISE ROW (IEP)
   ============================================================ */
.exercise-row {
    padding: 0.5rem !important;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

.exercise-row .form-control-sm {
    font-size: 0.8rem;
}

/* ============================================================
   LINE ITEM ROW (Invoice)
   ============================================================ */
.line-item-row {
    padding: 0.5rem !important;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    font-size: 0.8rem;
}

/* ============================================================
   RESPONSIVE HELPERS
   ============================================================ */
@media (max-width: 767.98px) {
    .card-body dl dt {
        font-size: 0.8rem;
    }

    .pipeline-step small {
        font-size: 0.55rem;
    }

    .pipeline-circle {
        width: 22px;
        height: 22px;
        font-size: 0.55rem;
    }

    .registration-steps {
        gap: 0.5rem;
    }

    .registration-steps .step {
        font-size: 0.75rem;
    }
}

/* ============================================================
   OFFCANVAS SIDEBAR (mobile)
   ============================================================ */
.offcanvas.bg-dark .sidebar-nav .nav-link {
    padding: 0.75rem 1.25rem;
}

/* ============================================================
   ALERTS ANIMATION
   ============================================================ */
.alert {
    border-radius: 0.5rem;
}

/* ============================================================
   REPORTS HUB
   ============================================================ */
.report-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1rem;
}

.report-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.report-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1) !important;
}

.report-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.bg-primary-subtle {
    background-color: rgba(13, 148, 136, 0.1) !important;
}

.bg-success-subtle {
    background-color: rgba(34, 197, 94, 0.1) !important;
}

.bg-info-subtle {
    background-color: rgba(6, 182, 212, 0.1) !important;
}

.bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.bg-purple-subtle {
    background-color: rgba(139, 92, 246, 0.1) !important;
}

.text-purple {
    color: #8b5cf6 !important;
}

/* ============================================================
   REPORT LIST CARDS (Card/List Toggle)
   ============================================================ */
.report-list-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.report-list-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.08) !important;
}

.report-list-card .card-footer {
    padding-bottom: 1rem;
}

.view-toggle.active {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

/* ============================================================
   FULLCALENDAR OVERRIDES
   ============================================================ */
.fc {
    font-size: 0.875rem;
}

.fc .fc-toolbar-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.fc .fc-button {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

.fc .fc-event {
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.fc .fc-daygrid-event {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc .fc-timegrid-slot {
    height: 2.5em;
}

@media (max-width: 767.98px) {
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .fc .fc-toolbar-title {
        font-size: 1rem;
    }

    .fc .fc-button {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .fc .fc-header-toolbar .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }

    .fc .fc-timegrid-slot {
        height: 2em;
    }

    .fc .fc-col-header-cell-cushion {
        font-size: 0.7rem;
    }

    .fc .fc-daygrid-day-number {
        font-size: 0.8rem;
    }
}

/* ============================================================
   SESSION CARDS & TOUCH TARGETS
   ============================================================ */
.session-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.08) !important;
}

.session-action-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Ensure all tappable elements in session views have adequate touch targets */
.list-group-item-action {
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* ============================================================
   FLOATING ACTION BUTTON (New Session)
   ============================================================ */
.fab-new-session {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 900;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.fab-new-session:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.5);
    color: #fff;
}

@media (min-width: 992px) {
    .fab-new-session {
        display: none;
    }
}

/* ============================================================
   WIZARD FORM (Prospect Registration)
   ============================================================ */
.wizard-progress {
    position: relative;
    padding: 0 1rem;
}

.wizard-progress .d-flex {
    z-index: 1;
}

.wizard-progress-bar {
    position: absolute;
    top: 18px;
    left: 0;
    height: 3px;
    background: var(--primary-color);
    transition: width 0.4s ease;
    z-index: 0;
    width: 0;
}

.wizard-progress::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 0;
    right: 0;
    height: 3px;
    background: #e2e8f0;
    z-index: 0;
}

.wizard-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 1;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.wizard-step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    border: 3px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.wizard-step-label {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.wizard-step-indicator.active .wizard-step-num {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35);
}

.wizard-step-indicator.active .wizard-step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.wizard-step-indicator.completed .wizard-step-num {
    background: var(--primary-color);
    color: #fff;
}

.wizard-step-indicator.completed .wizard-step-label {
    color: var(--primary-dark);
}

/* Hide non-active wizard panels */
.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: wizardFadeIn 0.3s ease;
}

@keyframes wizardFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Card-style checkboxes and radios */
.form-check-card {
    position: relative;
}

.form-check-card .form-check-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-check-card .form-check-label {
    display: block;
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    font-size: 0.875rem;
    user-select: none;
}

.form-check-card .form-check-input:checked + .form-check-label {
    border-color: var(--primary-color);
    background: rgba(13, 148, 136, 0.06);
    color: var(--primary-dark);
    font-weight: 500;
}

.form-check-card .form-check-label:hover {
    border-color: var(--primary-light);
    background: rgba(13, 148, 136, 0.03);
}

/* PAR-Q question items */
.parq-item {
    background: #f8fafc;
    border-color: #e2e8f0 !important;
    transition: border-color 0.2s;
}

.parq-item:has(.parq-radio[value="true"]:checked) {
    border-color: #fbbf24 !important;
    background: #fffbeb;
}

.parq-item:has(.parq-radio[value="false"]:checked) {
    border-color: var(--primary-color) !important;
    background: rgba(13, 148, 136, 0.03);
}

/* Availability table */
.availability-table th,
.availability-table td {
    vertical-align: middle;
    padding: 0.5rem;
}

.availability-table .form-check-input {
    width: 1.15em;
    height: 1.15em;
}

/* Mobile responsive wizard labels */
@media (max-width: 640px) {
    .wizard-step-label {
        display: none;
    }

    .wizard-step-num {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }
}

/* ============================================================
   NOTIFICATION BELL
   ============================================================ */
.notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* ============================================================
   SESSION LOG FORM
   ============================================================ */
.attendance-radio .form-check {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attendance-radio .form-check-label {
    cursor: pointer;
    padding: 0.25rem 0;
}

.star-rating .fa-star {
    cursor: default;
    font-size: 1rem;
}

/* ============================================================
   RESPONSIVE FORMS (Session Create/Edit)
   ============================================================ */
@media (max-width: 767.98px) {
    .session-form .form-control,
    .session-form .form-select {
        font-size: 16px; /* Prevents iOS zoom on focus */
        min-height: 44px;
    }

    .session-form .btn {
        min-height: 44px;
        font-size: 1rem;
    }

    .session-form .row > [class*="col-"] {
        margin-bottom: 0.5rem;
    }

    /* Stack filter forms on mobile */
    .card-body .row.g-3 > [class*="col-md"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ============================================================
   NOTIFICATION LIST
   ============================================================ */
.notification-item {
    transition: background-color 0.15s ease;
}

.notification-item.unread {
    background-color: rgba(13, 148, 136, 0.03);
    border-left: 3px solid var(--primary-color);
}

.notification-item .btn-sm {
    min-width: 44px;
    min-height: 44px;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar,
    .navbar,
    .footer,
    .btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }
}

/* ============================================================
   ACTION BAR (Card-based form footer)
   ============================================================ */
.action-bar {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 1.5rem;
}

.action-bar .card {
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.action-bar .card-body {
    padding: 0.75rem 1.25rem;
}

/* ============================================================
   LOADING SPINNER ON FORM SUBMIT
   ============================================================ */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading .btn-text {
    visibility: hidden;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-top: -0.5rem;
    margin-left: -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   ENHANCED EMPTY STATES
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #94a3b8;
}

.empty-state .empty-state-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.empty-state .empty-state-icon i {
    font-size: 1.75rem;
    color: #94a3b8;
}

.empty-state h6 {
    color: #475569;
    margin-bottom: 0.25rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.empty-state .btn {
    margin-top: 1rem;
}

/* ============================================================
   RESULT COUNT BADGE
   ============================================================ */
.result-count {
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.result-count .badge {
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================================
   FILTER BAR ENHANCEMENTS
   ============================================================ */
.filter-bar .btn-clear {
    font-size: 0.8rem;
    color: #64748b;
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    transition: all 0.15s;
}

.filter-bar .btn-clear:hover {
    color: #dc3545;
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

/* ============================================================
   PAGE HEADER ENHANCEMENTS
   ============================================================ */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h3 {
    margin-bottom: 0;
}

.page-header .page-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.15rem;
}

/* ============================================================
   TABLE ROW ACTIONS (consistent)
   ============================================================ */
.row-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: nowrap;
}

.row-actions .btn-sm {
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
}

/* ============================================================
   CARD HOVER LIFT (reusable)
   ============================================================ */
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.08) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
}

/* ============================================================
   MOBILE: FORM ACTION BARS FULL-WIDTH
   ============================================================ */
@media (max-width: 767.98px) {
    .action-bar {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        border-radius: 0;
    }

    .action-bar .card {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .row-actions .btn-sm {
        min-width: 38px;
        min-height: 38px;
    }

    .empty-state {
        padding: 2rem 1rem;
    }
}
