/* ==========================================================================
   Global Custom Scrollbar
   ========================================================================== */

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

/* For Chrome, Edge, Safari */
*::-webkit-scrollbar {
    width: 5px;  /* Vertical scrollbar width */
    height: 5px; /* Horizontal scrollbar height */
}

*::-webkit-scrollbar-track {
    background: transparent; /* Keeps the background clean */
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
    background-color: #d1d5db; /* Tailwind gray-300 */
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af; /* Tailwind gray-400 */
}

/* Keep your existing hide-scrollbar utility untouched so it still works */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* System fonts for ultra-sharp, native app feel */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    background-color: #000;
    color: #111827;
    margin: 0;
    padding: 0;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app-wrapper {
    max-width: 480px;
    margin: 0 auto;
    background-color: #ffffff;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Native iOS Screen Transitions */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 10;
}

.screen-hidden-right { transform: translateX(100%); z-index: 20; }
.screen-hidden-left { transform: translateX(-30%); z-index: 10; opacity: 0.8; }
.screen-active { transform: translateX(0); z-index: 20; opacity: 1; }

/* Bottom Sheet Modals */
.bottom-sheet {
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    z-index: 100;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
}
.bottom-sheet.open { transform: translateY(0); }

.backdrop {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    max-width: 480px;
    margin: 0 auto;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

/* Accordions and Animations */
.day-content {
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
}
.day-content.expanded { max-height: 3000px; opacity: 1; display: flex; }
.chevron { transition: transform 0.3s ease; }
.chevron.rotated { transform: rotate(180deg); }

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

textarea.auto-expand { resize: none; overflow: hidden; min-height: 24px; }

/* Unified Pill Group */
.group-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    background: #ffffff;
}
.group-pill-item { 
    padding: 5px 14px; 
    border-right: 1px solid #e5e7eb; 
    display: flex;
    align-items: center;
}
.group-pill-item:last-child { 
    border-right: none; 
}

/* Custom Toggle Switch */
.toggle-switch {
    appearance: none;
    width: 40px;
    height: 24px;
    background: #e5e7eb;
    border-radius: 24px;
    position: relative;
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch:checked { background: #000; }
.toggle-switch:checked::after { transform: translateX(16px); }

/* Multi-location Pill */
.loc-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 999px; font-size: 14px; font-weight: 600; }

/* Video gradient - Updated for better video visibility */
.video-gradient { 
    background: linear-gradient(to bottom, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,1) 95%, rgba(255,255,255,1) 100%); 
}

/* Calendar Grid */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.cal-day.empty { pointer-events: none; }
.cal-day:hover:not(.empty) { background-color: #f3f4f6; }
.cal-day.selected { background-color: #000; color: #fff; font-weight: bold; }
.cal-day.in-range { background-color: #e5e7eb; border-radius: 0; }
.cal-day.range-start { background-color: #000; color: #fff; border-radius: 50% 0 0 50%; }
.cal-day.range-end { background-color: #000; color: #fff; border-radius: 0 50% 50% 0; }
.cal-day.range-start.range-end { border-radius: 50%; }

/* Markdown Preview Styling (Dark Mode Reddit Mock) */
.reddit-preview {
    background-color: #0b1416;
    color: #d7dadc;
    font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border-radius: 12px;
    padding: 16px;
}
.reddit-preview h1 { font-size: 18px; font-weight: 600; color: #d7dadc; margin-bottom: 8px; line-height: 1.3; }
.reddit-preview h2 { font-size: 16px; font-weight: 600; margin-top: 16px; margin-bottom: 8px; }
.reddit-preview h3 { font-size: 14px; font-weight: 600; margin-top: 12px; margin-bottom: 4px; }
.reddit-preview p { font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.reddit-preview ul { list-style-type: disc; margin-left: 20px; font-size: 14px; margin-bottom: 12px; }
.reddit-preview li { margin-bottom: 6px; }
.reddit-preview blockquote { border-left: 4px solid #343536; padding-left: 12px; margin-left: 0; color: #818384; font-style: italic; }


.drop-placeholder {
    background-color: #f9fafb !important; /* Soft gray */
    border: 2px dashed #d1d5db !important; /* Muted dashed border */
    opacity: 0.6;
}
.drop-placeholder * {
    visibility: hidden; /* Hide content of the block being hovered over to look like a hole */
}

/* The hidden spacer between cards */
.drop-zone-spacer {
    height: 8px;
    transition: all 0.2s ease;
    width: 100%;
    border-radius: 12px;
    margin: 2px 0;
}

/* The expanded skeleton state */
.drop-zone-spacer.active {
    height: 80px; /* Adjust to match your card height */
    background-color: #f9fafb;
    border: 2px dashed #d1d5db;
    margin: 12px 0;
}

/* Ensure spacers take up ZERO height when not dragging */
.drop-zone-spacer {
    height: 0px !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    border: 2px dashed transparent;
}

/* The Skeleton state when dragging over */
.drop-zone-spacer.active {
    height: 80px !important; /* Height of a collapsed day card */
    background-color: #f9fafb !important; /* Soft gray */
    border: 2px dashed #d1d5db !important; /* Dashed border */
    margin: 12px 0 !important;
    opacity: 1 !important;
}

/* Ensure the preview background is clean white */
#itin-preview-sheet {
    background-color: #ffffff !important;
}

#preview-content::-webkit-scrollbar {
    width: 4px;
}

#preview-content::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

@media print {
    .bg-gray-50 { background-color: #f9fafb !important; -webkit-print-color-adjust: exact; }
    .bg-blue-50 { background-color: #eff6ff !important; -webkit-print-color-adjust: exact; }
    .text-blue-500 { color: #3b82f6 !important; }
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}

/* Custom Snap Animation: Slow start, fast finish */
@keyframes letterSnap {
    0% { 
        opacity: 0; 
        transform: translateY(12px) scale(0.9); 
        filter: blur(8px); 
    }
    60% {
        opacity: 0.5;
        filter: blur(2px);
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
        filter: blur(0); 
    }
}

.letter {
    display: inline-block;
    opacity: 0;
    /* This cubic-bezier creates the slow -> fast feel */
    animation: letterSnap 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#loader-container.fade-out {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

#public-view-root {
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.content-hidden {
    opacity: 0;
    transform: translateY(10px);
}

.content-visible {
    opacity: 1;
    transform: translateY(0);
}