/* ============================================
   LawTrack — Apple iOS 18 Design System
   Inspired by Apple Health, Reminders & Settings
   ============================================ */

/* ---------- Apple Font Stack & Base ---------- */
:root {
    --ios-bg: #F2F2F7;
    --ios-card: #FFFFFF;
    --ios-card-secondary: #F9F9FB;
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-orange: #FF9500;
    --ios-purple: #AF52DE;
    --ios-indigo: #5856D6;
    --ios-red: #FF3B30;
    --ios-gray: #8E8E93;
    --ios-gray-2: #AEAEB2;
    --ios-gray-3: #C7C7CC;
    --ios-gray-4: #D1D1D6;
    --ios-gray-5: #E5E5EA;
    --ios-gray-6: #F2F2F7;
    --ios-label: #1C1C1E;
    --ios-secondary-label: #8E8E93;
    --ios-separator: rgba(60, 60, 67, 0.12);
    --ios-squircle: 20px;
    --ios-squircle-sm: 14px;
    --ios-squircle-lg: 26px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--ios-bg);
    color: var(--ios-label);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.015em;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* ---------- Apple Frosted Glass / Translucency ---------- */
.ios-glass {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.ios-glass-nav {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.15);
}

.ios-glass-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--ios-squircle);
    box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ios-card {
    background: #FFFFFF;
    border-radius: var(--ios-squircle);
    border: 0.5px solid rgba(60, 60, 67, 0.08);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.03);
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.ios-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    transform: translateY(-1.5px);
}

/* ---------- Micro-Interactions (Haptic Feel) ---------- */
.ios-pressable {
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ios-pressable:active {
    transform: scale(0.97);
    opacity: 0.88;
}

/* ---------- Typography Hierarchy ---------- */
.ios-large-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.15;
    color: var(--ios-label);
}

.ios-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--ios-label);
}

.ios-headline {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.ios-subhead {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--ios-secondary-label);
}

.ios-caption {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ios-secondary-label);
    letter-spacing: 0.01em;
}

/* ---------- Apple Reminders Circular Checkbox ---------- */
.topic-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--ios-gray-3);
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    flex-shrink: 0;
    background-color: transparent;
}

.topic-checkbox:hover {
    border-color: var(--ios-blue);
    transform: scale(1.08);
}

.topic-checkbox:checked {
    background-color: var(--ios-blue);
    border-color: var(--ios-blue);
    transform: scale(1.05);
}

.topic-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 8px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@keyframes spring-pop {
    0% { transform: scale(0.85); }
    50% { transform: scale(1.22); }
    100% { transform: scale(1.05); }
}

.animate-pulse-check {
    animation: spring-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- iOS Progress Capsules (Apple Health Style) ---------- */
.progress-bar-track {
    height: 8px;
    background-color: var(--ios-gray-5);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar-fill.green {
    background: linear-gradient(90deg, #30D158, #34C759);
    box-shadow: 0 0 10px rgba(52, 199, 89, 0.35);
}

.progress-bar-fill.yellow {
    background: linear-gradient(90deg, #FF9F0A, #FF9500);
    box-shadow: 0 0 10px rgba(255, 149, 0, 0.35);
}

.progress-bar-fill.red {
    background: linear-gradient(90deg, #FF453A, #FF3B30);
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.35);
}

.progress-bar-fill.indigo,
.progress-bar-fill.blue {
    background: linear-gradient(90deg, #0A84FF, #007AFF);
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.35);
}

/* ---------- Inset Grouped List (iOS Settings / Reminders Style) ---------- */
.ios-inset-group {
    background: #FFFFFF;
    border-radius: var(--ios-squircle);
    border: 0.5px solid rgba(60, 60, 67, 0.08);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.ios-list-row {
    padding: 13px 16px;
    display: flex;
    align-items: center;
    transition: background-color 0.15s ease;
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
}

.ios-list-row:last-child {
    border-bottom: none;
}

.ios-list-row:hover {
    background-color: var(--ios-card-secondary);
}

/* ---------- Unit Accordion (iOS Inset Disclosure) ---------- */
.unit-header {
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: none;
}

.unit-header:hover {
    background-color: rgba(0, 0, 0, 0.015);
}

.unit-header:active {
    background-color: rgba(0, 0, 0, 0.04);
}

.unit-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.unit-content.open {
    max-height: 2500px;
    transition: max-height 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.unit-chevron {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.unit-chevron.rotated {
    transform: rotate(90deg);
}

/* ---------- Subject Card (iOS App Store Style) ---------- */
.subject-card {
    background: #FFFFFF;
    border-radius: var(--ios-squircle-lg);
    border: 0.5px solid rgba(60, 60, 67, 0.08);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.subject-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.07);
    border-color: rgba(0, 122, 255, 0.2);
}

.subject-card:active {
    transform: scale(0.98);
}

/* Squircle Icon Wrapper */
.ios-squircle-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ---------- Floating Bottom Navigation (Native iPhone Tab Bar) ---------- */
.ios-floating-tabbar {
    position: fixed;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    width: calc(100% - 24px);
    max-width: 390px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(28px) saturate(200%);
    -webkit-backdrop-filter: blur(28px) saturate(200%);
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 9999px;
    padding: 5px 6px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ios-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    padding: 4px 4px;
    border-radius: 9999px;
    color: var(--ios-gray);
    font-size: 0.62rem;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    white-space: nowrap;
}

.ios-tab-item svg,
.ios-tab-item .tab-icon {
    font-size: 1.25rem;
    margin-bottom: 1px;
    transition: transform 0.2s ease;
}

.ios-tab-item.active {
    color: var(--ios-blue);
    background: rgba(0, 122, 255, 0.09);
}

.ios-tab-item.active svg,
.ios-tab-item.active .tab-icon {
    transform: scale(1.12);
}

/* ---------- Dynamic Island / Capsule Toast Notification ---------- */
#toast-container {
    position: fixed;
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 90%;
    max-width: 420px;
}

.ios-toast {
    pointer-events: auto;
    background: rgba(28, 28, 30, 0.94);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    color: #FFFFFF;
    border-radius: 9999px;
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 0.5px solid rgba(255, 255, 255, 0.15);
    animation: dynamic-island-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s ease;
}

@keyframes dynamic-island-in {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.85);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ---------- Apple Inputs ---------- */
.ios-input {
    width: 100%;
    background-color: var(--ios-gray-6);
    border: 1px solid rgba(60, 60, 67, 0.1);
    border-radius: var(--ios-squircle-sm);
    padding: 12px 14px;
    font-size: 0.95rem;
    color: var(--ios-label);
    outline: none;
    transition: all 0.2s ease;
}

.ios-input:focus {
    background-color: #FFFFFF;
    border-color: var(--ios-blue);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

.ios-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 38px;
}

/* ---------- Apple Segmented Control ---------- */
.ios-segmented {
    background: var(--ios-gray-5);
    border-radius: 12px;
    padding: 3px;
    display: flex;
    position: relative;
}

.ios-segmented-item {
    flex: 1;
    text-align: center;
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ios-secondary-label);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    user-select: none;
}

.ios-segmented-item.active {
    background: #FFFFFF;
    color: var(--ios-label);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 0.5px 2px rgba(0, 0, 0, 0.06);
}

/* ---------- Apple Pills & Badges ---------- */
.ios-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.ios-badge-blue { background: rgba(0, 122, 255, 0.1); color: var(--ios-blue); }
.ios-badge-green { background: rgba(52, 199, 89, 0.1); color: #248A3D; }
.ios-badge-orange { background: rgba(255, 149, 0, 0.12); color: #C97200; }
.ios-badge-gray { background: rgba(142, 142, 147, 0.12); color: var(--ios-label); }

/* ---------- Leaderboard Row ---------- */
.leaderboard-row {
    transition: all 0.18s ease;
    border-radius: 14px;
    margin: 2px 6px;
}

.leaderboard-row:hover {
    background-color: var(--ios-card-secondary);
}

.leaderboard-row.current-user {
    background: rgba(0, 122, 255, 0.08);
    border: 1px solid rgba(0, 122, 255, 0.2);
}

/* ---------- OTP Input (Responsive Cupertino Box) ---------- */
.otp-input {
    width: 40px;
    height: 50px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    background: var(--ios-gray-6);
    border: 1.5px solid var(--ios-gray-4);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    color: var(--ios-label);
}

@media (min-width: 380px) {
    .otp-input {
        width: 44px;
        height: 54px;
        font-size: 1.5rem;
        border-radius: 14px;
    }
}

.otp-input:focus {
    background: #FFFFFF;
    border-color: var(--ios-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
    transform: scale(1.04);
}

/* ---------- Apple Smooth Animations ---------- */
@keyframes ios-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ios-slide-up {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-fade-in {
    animation: ios-fade-in 0.35s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.animate-slide-up {
    animation: ios-slide-up 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.stagger-1 { animation-delay: 0.04s; }
.stagger-2 { animation-delay: 0.08s; }
.stagger-3 { animation-delay: 0.12s; }
.stagger-4 { animation-delay: 0.16s; }
.stagger-5 { animation-delay: 0.20s; }
.stagger-6 { animation-delay: 0.24s; }

/* ---------- Scrollbar (iOS Ultra-thin) ---------- */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ---------- Mobile Specific Overrides & iOS Optimization ---------- */
@media (max-width: 640px) {
    /* Prevent iOS Safari auto-zoom on input focus */
    input[type="text"],
    input[type="tel"],
    input[type="email"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }

    .ios-large-title {
        font-size: 1.6rem;
    }

    .ios-card {
        border-radius: 18px;
    }
}

/* Safe area padding for mobile bottom bar */
@media (max-width: 768px) {
    main {
        padding-bottom: calc(105px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ---------- Semester Pills (Apple Cupertino Style) ---------- */
.sem-pill {
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid transparent;
}

.sem-pill-active {
    background: #007AFF;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.35);
    border-color: #007AFF;
}

.sem-pill-inactive {
    background: rgba(0, 0, 0, 0.05);
    color: #6B7280;
    border-color: rgba(0, 0, 0, 0.06);
}

.sem-pill-inactive:hover {
    background: rgba(0, 0, 0, 0.09);
    color: #111827;
}

.sem-pill-locked {
    background: rgba(0, 0, 0, 0.03);
    color: #9CA3AF;
    border: 1px dashed rgba(0, 0, 0, 0.16);
    cursor: pointer;
    opacity: 0.85;
}

.sem-pill-locked:hover {
    background: rgba(245, 158, 11, 0.08);
    color: #B45309;
    border-color: rgba(245, 158, 11, 0.35);
}

.sem-pill-locked-active {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #F59E0B;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.scrollbar-none::-webkit-scrollbar {
    display: none;
}
.scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ---------- Apple Cupertino Button Styles ---------- */
.apple-primary-btn {
    background: linear-gradient(180deg, #0077ED 0%, #0062C4 100%) !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.38), 0 10px 24px -4px rgba(0, 113, 227, 0.38);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.apple-primary-btn:hover {
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 14px 28px -4px rgba(0, 113, 227, 0.48);
    transform: translateY(-1px);
}
.apple-primary-btn:active {
    transform: scale(0.97);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 113, 227, 0.3);
}

/* ---------- Apple Cupertino App Footer ---------- */
.ios-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ---------- Apple Sticky Notes & Assignments ---------- */
.sticky-note-card {
    border-radius: 20px;
    padding: 16px 18px;
    position: relative;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

.sticky-note-card:hover {
    transform: translateY(-2.5px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.sticky-tape {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 16px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sticky-yellow {
    background: #FEF9C3;
    border: 1px solid #FDE047;
    color: #713F12;
}

.sticky-green {
    background: #DCFCE7;
    border: 1px solid #86EFAC;
    color: #14532D;
}

.sticky-blue {
    background: #E0F2FE;
    border: 1px solid #7DD3FC;
    color: #075985;
}

.sticky-purple {
    background: #F3E8FF;
    border: 1px solid #D8B4FE;
    color: #581C87;
}

.sticky-pink {
    background: #FFE4E6;
    border: 1px solid #FDA4AF;
    color: #881337;
}

.assignment-completed {
    opacity: 0.68;
    text-decoration: line-through;
}



