/* Vercel/Linear Premium Developer Theme */

/* --- Custom Scrollbars --- */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(161, 161, 170, 0.15);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(161, 161, 170, 0.35);
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
}
.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Editor Layout & Sync Scroll Line Numbers --- */
.editor-container {
    display: flex;
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    height: 100%;
    min-height: 380px;
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
}

.line-numbers-col {
    flex-shrink: 0;
    user-select: none;
    text-align: right;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    padding-left: 0.85rem;
    padding-right: 0.65rem;
    font-size: 11px;
    line-height: 1.6rem;
    color: #a1a1aa;
    background-color: #f4f4f5;
    border-right: 1px solid #e4e4e7;
    overflow-y: hidden;
    scrollbar-width: none; /* Hide scrollbars */
}
.line-numbers-col::-webkit-scrollbar {
    display: none;
}

.dark .line-numbers-col {
    color: #52525b;
    background-color: #09090b;
    border-right: 1px solid #18181b;
}

.editor-textarea {
    flex-grow: 1;
    padding: 0.85rem;
    font-size: 11px;
    line-height: 1.6rem;
    background-color: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
    white-space: pre;
    tab-size: 4;
    caret-color: #a855f7; /* Violet cursor */
}

.dark-grid-bg {
    background-size: 32px 32px;
    background-image: 
        linear-gradient(to right, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.025) 1px, transparent 1px);
}
.dark .dark-grid-bg {
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
}

/* --- Collapsible Sidebar System --- */
#sidebar-panel {
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar-panel.collapsed {
    width: 4rem; /* 64px width */
}

#sidebar-panel.collapsed .sidebar-label,
#sidebar-panel.collapsed #tool-search-wrapper,
#sidebar-panel.collapsed .category-header {
    display: none !important;
}

#sidebar-panel.collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0.25rem auto;
}

#sidebar-panel.collapsed .sidebar-link i {
    margin-right: 0;
    width: 1.1rem;
    height: 1.1rem;
}

/* Sidebar Active states */
.sidebar-link {
    border-radius: 0.375rem;
    border: 1px solid transparent; /* Prevent layout shift when active border is added */
    transition: background-color 0.1s ease, border-color 0.1s ease, color 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link.active {
    background-color: #18181b;
    border: 1px solid #27272a;
    color: #ffffff;
}

.dark .sidebar-link.active {
    background-color: #18181b;
    border: 1px solid #27272a;
    color: #ffffff;
}

/* --- Vercel Card styling --- */
.card-dark {
    background-color: #ffffff;
    border: 1px solid #e4e4e7;
}
.dark .card-dark {
    background-color: #09090b;
    border: 1px solid #18181b;
}

/* Focus and input states */
.input-premium {
    background-color: #ffffff;
    border: 1px solid #e4e4e7;
    outline: none;
    transition: all 0.15s ease;
}
.dark .input-premium {
    background-color: #09090b;
    border: 1px solid #18181b;
}

/* Dynamic Accent Glow Effects */
.focus-ring-purple:focus-within {
    border-color: rgba(168, 85, 247, 0.5) !important;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.15);
}
.focus-ring-cyan:focus-within {
    border-color: rgba(6, 182, 212, 0.5) !important;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.15);
}

/* --- Animated Toast Alerts --- */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
.animate-toast-in {
    animation: slideInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-toast-out {
    animation: fadeOut 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* JSON Validation colors */
.json-success-badge {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.json-error-badge {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* --- Responsive Media Queries (Mobile & Tablet) --- */
@media (max-width: 768px) {
    /* Overlay Sidebar on Mobile */
    #sidebar-panel {
        position: fixed;
        top: 3.5rem; /* Header height (h-14 = 56px) */
        bottom: 0;
        left: 0;
        z-index: 45;
        width: 16rem !important; /* Forces standard open width on mobile */
        transform: translateX(-100%);
        box-shadow: 15px 0 35px rgba(0, 0, 0, 0.3);
        background-color: #ffffff;
    }
    
    .dark #sidebar-panel {
        background-color: #09090b;
    }

    #sidebar-panel.open {
        transform: translateX(0);
    }

    /* Backdrop overlay style */
    #sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        top: 3.5rem;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
        z-index: 40;
    }

    #sidebar-backdrop.active {
        display: block;
    }

    /* Ignore standard desktop collapsed transitions on mobile links */
    #sidebar-panel.collapsed {
        width: 16rem !important;
        transform: translateX(-100%);
    }

    #sidebar-panel.collapsed.open {
        transform: translateX(0);
    }
}

@media (max-width: 640px) {
    /* Padding constraints on small screens */
    section.flex-grow {
        padding: 0.5rem !important;
    }
    
    /* Optimize editors height on mobile */
    .editor-container {
        min-height: 260px !important;
    }
    
    /* Minimal padding for card elements on mobile */
    .card-dark {
        padding: 0.75rem !important;
        border-radius: 0.375rem !important;
    }
    
    /* Textarea font-sizes and line heights slightly tighter on small screens */
    .editor-textarea {
        font-size: 11px;
        line-height: 1.45rem;
        padding: 0.5rem;
    }
    .line-numbers-col {
        font-size: 10px;
        line-height: 1.45rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}
