/* Mobile App-like Styling */

:root {
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
    --safe-area-inset-top: env(safe-area-inset-top);
    --safe-area-inset-left: env(safe-area-inset-left);
    --safe-area-inset-right: env(safe-area-inset-right);
}

/* Agenda Page Optimization */
.fc-toolbar {
    display: none !important;
}

.view-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 0.5rem;
}

.view-btn:active {
    transform: scale(0.95);
}

.filter-btn {
    white-space: nowrap;
    transition: all 0.2s ease;
}

.filter-btn:active {
    transform: scale(0.95);
}

/* Calendar Week View Optimization */
.fc-timegrid-slot {
    height: 1.5em;
}

.fc-col-header-cell {
    padding: 0.5rem 0.25rem !important;
    word-wrap: break-word;
}

/* Hide scrollbars while keeping functionality */
body {
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Input/Textarea selections */
input, textarea, select {
    -webkit-user-select: text;
}

/* Prevent zoom on input focus */
input, select, textarea {
    font-size: 16px !important;
}

/* Mobile Navigation Bar */
@media (max-width: 640px) {
    /* Top navigation bar styling */
    nav.fixed {
        position: sticky;
        top: 0;
        z-index: 50;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    /* Bottom navigation specific styles */
    nav:last-of-type {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        z-index: 40;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        border-bottom: none;
    }

    main {
        scroll-padding-top: 64px;
        scroll-padding-bottom: calc(64px + env(safe-area-inset-bottom));
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    /* Full-width cards on mobile */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Optimized padding for mobile */
    .px-4 {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Mobile-friendly touch targets (minimum 44px) */
    button, a, [role="button"] {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Modal improvements for mobile */
    .fixed {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent double-tap zoom on buttons */
    a, button {
        -webkit-touch-callout: none;
    }

    /* Safe spacing from notch */
    header {
        padding-top: calc(1rem + env(safe-area-inset-top));
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* Mobile card rounded corners */
    .rounded-3xl {
        border-radius: 20px;
    }

    .rounded-2xl {
        border-radius: 16px;
    }

    /* Larger tap areas on mobile (Android prefers 48px) */
    .sm\:p-3 {
        padding: 12px !important;
    }

    /* Bottom sheet animations */
    .animate-in {
        animation: slideUp 0.3s ease-out;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* Mobile-friendly grid */
    .grid {
        gap: 12px;
    }

    /* Reduce font sizes slightly on mobile for better fit */
    body {
        font-size: 15px;
    }

    .text-sm {
        font-size: 13px;
    }

    .text-xs {
        font-size: 11px;
    }

    /* Improve readability on mobile */
    .line-clamp-2 {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Mobile status bar color */
    nav {
        border-bottom: 1px solid #f1f5f9;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    /* Better form input styling on mobile */
    input, textarea, select {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 16px;
    }

    input[type="color"] {
        min-height: 44px;
        padding: 8px;
    }

    /* Remove input zoom on focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* Mobile-friendly spacing */
    .space-y-2 {
        --tw-space-y-reverse: 0;
        margin-top: calc(8px * calc(1 - var(--tw-space-y-reverse)));
        margin-bottom: calc(8px * var(--tw-space-y-reverse));
    }

    .space-y-3 {
        --tw-space-y-reverse: 0;
        margin-top: calc(12px * calc(1 - var(--tw-space-y-reverse)));
        margin-bottom: calc(12px * var(--tw-space-y-reverse));
    }

    .space-y-4 {
        --tw-space-y-reverse: 0;
        margin-top: calc(16px * calc(1 - var(--tw-space-y-reverse)));
        margin-bottom: calc(16px * var(--tw-space-y-reverse));
    }

    /* Improved modal styling */
    .fixed.inset-0 {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
    }

    /* Bottom sheet modal */
    @supports (padding: max(0px)) {
        main {
            padding-bottom: max(24px, var(--safe-area-inset-bottom));
        }
    }

    /* List items with proper touch targets */
    .hover\:bg-slate-50:hover {
        background-color: #f8fafc;
    }

    .transition-all {
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Mobile-optimized buttons */
    button {
        -webkit-user-select: none;
        user-select: none;
    }

    button:active {
        opacity: 0.7;
    }

    /* Notch-aware padding */
    @supports (padding: max(0px)) {
        nav {
            padding-top: max(12px, var(--safe-area-inset-top));
        }

        main {
            padding-left: max(12px, var(--safe-area-inset-left));
            padding-right: max(12px, var(--safe-area-inset-right));
        }
    }
}

/* Tablet and larger - restore normal sizing */
@media (min-width: 769px) {
    .text-sm {
        font-size: 14px;
    }

    .text-xs {
        font-size: 12px;
    }

    body {
        font-size: 16px;
    }

    input, textarea, select {
        font-size: 14px;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) {
    header {
        padding: 8px 16px;
    }

    .hidden-landscape {
        display: none !important;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-user-select: none;
    }

    input, textarea, select {
        -webkit-user-select: text;
    }

    /* Fix for iPhone notch */
    main {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Better performance on iOS */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    button, a {
        -webkit-touch-callout: none;
    }
}

/* Android specific fixes */
@media (pointer: coarse) {
    button, a, [role="button"] {
        min-height: 48px;
        padding: 12px 16px;
    }

    input, select, textarea {
        min-height: 44px;
    }
}

/* PWA standalone mode */
@media (display-mode: standalone) {
    nav {
        background: rgba(255, 255, 255, 0.98);
    }

    main {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* Improve typography rendering */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Remove input appearance issues */
textarea {
    resize: none;
}

/* Focus styles for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

button, a {
    transition-duration: 150ms;
}

/* ============= MOBILE BOTTOM NAVIGATION STYLES ============= */
@media (max-width: 640px) {
    /* Bottom navigation bar styling */
    nav.fixed.bottom-0 {
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px) saturate(1.2);
        -webkit-backdrop-filter: blur(12px) saturate(1.2);
        box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05), 0 -1px 12px rgba(0, 0, 0, 0.08);
    }

    /* Bottom nav flex container */
    nav.fixed.bottom-0 > div {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 64px;
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Navigation items */
    nav.fixed.bottom-0 a,
    nav.fixed.bottom-0 button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        padding: 8px 2px;
        border-radius: 8px;
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 0.3px;
        min-height: unset;
        min-width: unset;
        gap: 4px;
        position: relative;
    }

    /* Icon styling in nav */
    nav.fixed.bottom-0 svg {
        width: 24px;
        height: 24px;
        stroke-width: 2;
    }

    /* Active state for nav items */
    nav.fixed.bottom-0 a.text-blue-600,
    nav.fixed.bottom-0 a.text-purple-600,
    nav.fixed.bottom-0 a.text-green-600,
    nav.fixed.bottom-0 a.text-orange-600,
    nav.fixed.bottom-0 a.text-red-600 {
        font-weight: 600;
    }

    /* Hover state */
    nav.fixed.bottom-0 a:not([class*="text-blue"]):not([class*="text-purple"]):not([class*="text-green"]):not([class*="text-orange"]):not([class*="text-red"]):hover,
    nav.fixed.bottom-0 button:hover {
        background-color: rgba(148, 163, 184, 0.05);
    }

    /* Active background */
    nav.fixed.bottom-0 a[class*="bg-blue-50"],
    nav.fixed.bottom-0 a[class*="bg-purple-50"],
    nav.fixed.bottom-0 a[class*="bg-green-50"],
    nav.fixed.bottom-0 a[class*="bg-orange-50"],
    nav.fixed.bottom-0 a[class*="bg-red-50"] {
        border-radius: 12px;
    }

    /* Dropdown menu styling */
    nav.fixed.bottom-0 > div > div {
        position: absolute;
        bottom: calc(64px + 8px);
        width: 192px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(0, 0, 0, 0.05);
        overflow: hidden;
        z-index: 50;
    }

    /* Dropdown menu items */
    nav.fixed.bottom-0 > div > div a,
    nav.fixed.bottom-0 > div > div button {
        display: block;
        width: 100%;
        padding: 12px 16px;
        text-align: left;
        border-radius: 0;
        flex-direction: row;
        gap: 12px;
        font-size: 14px;
        font-weight: 400;
        letter-spacing: normal;
        color: rgb(51, 65, 85);
        border: none;
        background: transparent;
        justify-content: flex-start;
    }

    nav.fixed.bottom-0 > div > div a:hover,
    nav.fixed.bottom-0 > div > div button:hover {
        background-color: rgba(15, 23, 42, 0.03);
        color: rgb(30, 41, 59);
    }

    /* Dropdown divider */
    nav.fixed.bottom-0 > div > div hr {
        margin: 4px 0;
        border: none;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    /* Badge positioning */
    nav.fixed.bottom-0 a .absolute {
        top: -6px;
        right: -2px;
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    /* Touch feedback on nav items */
    nav.fixed.bottom-0 a:active,
    nav.fixed.bottom-0 button:active {
        transform: scale(0.92);
        opacity: 0.7;
    }

    /* Safe area inset for bottom nav */
    nav.fixed.bottom-0 {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

    /* Adjust main content for bottom nav */
    main {
        padding-bottom: calc(max(64px, 64px + env(safe-area-inset-bottom)));
    }

    /* Prevent content overlap with bottom nav */
    body > div:last-child {
        position: relative;
        z-index: 35;
    }
}

