/* Draftless - Main Stylesheet */
/* This file will be replaced with compiled Tailwind in production */

/* ============================================
   Alpine.js Cloak - Hide elements until Alpine loads
   ============================================ */
[x-cloak] {
    display: none !important;
}

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Brand Colors */
    --color-primary-50: #f0f9ff;
    --color-primary-100: #e0f2fe;
    --color-primary-200: #bae6fd;
    --color-primary-300: #7dd3fc;
    --color-primary-400: #38bdf8;
    --color-primary-500: #0ea5e9;
    --color-primary-600: #0284c7;
    --color-primary-700: #0369a1;
    --color-primary-800: #075985;
    --color-primary-900: #0c4a6e;
    
    /* Neutral Colors */
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    --color-gray-950: #030712;
    
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    
    /* Spacing */
    --sidebar-width: 16rem;
    --header-height: 4rem;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Dark mode overrides */
.dark {
    --color-gray-50: #111827;
    --color-gray-100: #1f2937;
    --color-gray-200: #374151;
    --color-gray-800: #f3f4f6;
    --color-gray-900: #f9fafb;
}


/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
}


/* ============================================
   Focus & Accessibility
   ============================================ */
:focus-visible {
    outline: 2px solid #18181b; /* zinc-900 */
    outline-offset: 2px;
}

.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.15); /* zinc-900 with opacity */
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--color-primary-600);
    color: white;
}

.skip-link:focus {
    top: 0;
}


/* ============================================
   Typography Utilities
   ============================================ */
.font-mono {
    font-family: var(--font-mono);
}

.text-balance {
    text-wrap: balance;
}

/* Premium heading styles */
.heading-display {
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.heading-section {
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.3;
}


/* ============================================
   Layout: App Shell
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 40;
    transition: transform var(--transition-base);
}

.app-sidebar.collapsed {
    transform: translateX(-100%);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-base);
}

.app-main.expanded {
    margin-left: 0;
}

/* Mobile: sidebar overlay */
@media (max-width: 1023px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(24, 24, 27, 0.4); /* zinc-900 with lower opacity */
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 30;
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition-base), visibility var(--transition-base);
    }
    
    .sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
    }
}


/* ============================================
   Components: Cards
   ============================================ */
.card {
    background: white;
    border-radius: 1rem; /* rounded-2xl */
    border: 1px solid #e4e4e7; /* zinc-200 */
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08);
    border-color: #d4d4d8; /* zinc-300 */
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    border-color: #18181b; /* zinc-900 */
    transform: translateY(-1px);
}

.dark .card {
    background: var(--color-gray-800);
    border-color: var(--color-gray-700);
}

/* Glass card variant */
.card-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(228, 228, 231, 0.8);
}


/* ============================================
   Components: Buttons
   ============================================ */

/* Force black button - overrides Tailwind forms reset and Flowbite */
.btn-primary,
button.btn-primary,
input[type="submit"].btn-primary {
    background-color: #18181b !important; /* zinc-900 */
    color: #ffffff !important;
    border-color: #18181b !important;
}

.btn-primary:hover,
button.btn-primary:hover,
input[type="submit"].btn-primary:hover {
    background-color: #3f3f46 !important; /* zinc-700 - more visible hover */
    border-color: #3f3f46 !important;
}

.btn-primary:focus,
button.btn-primary:focus,
input[type="submit"].btn-primary:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #71717a !important; /* zinc-500 ring */
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Auth form submit buttons */
.auth-submit-btn {
    background-color: #18181b !important;
    color: #ffffff !important;
    border: 1px solid #18181b !important;
}

.auth-submit-btn:hover {
    background-color: #3f3f46 !important;
    border-color: #3f3f46 !important;
}

.auth-submit-btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #71717a !important;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-md);
}


/* ============================================
   Components: Forms
   ============================================ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-700);
}

.dark .form-label {
    color: var(--color-gray-300);
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-gray-900);
    background: white;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: #18181b; /* zinc-900 */
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.1);
}

.form-input::placeholder {
    color: var(--color-gray-400);
}

.dark .form-input {
    background: var(--color-gray-800);
    border-color: var(--color-gray-600);
    color: white;
}

.form-error {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: #dc2626;
}

.form-hint {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-gray-500);
}


/* ============================================
   Components: Empty States
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin-bottom: 1.5rem;
    color: var(--color-gray-400);
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-gray-900);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: 0.875rem;
    color: var(--color-gray-500);
    max-width: 24rem;
    margin-bottom: 1.5rem;
}


/* ============================================
   Components: Loading States
   ============================================ */
.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 1rem;
    height: 1rem;
}

.spinner-lg {
    width: 2rem;
    height: 2rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-gray-200) 25%,
        var(--color-gray-100) 50%,
        var(--color-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ============================================
   Components: Badges
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background: #f4f4f5; /* zinc-100 */
    color: #18181b; /* zinc-900 */
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-gray {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
}


/* ============================================
   Components: Dropdown Menu
   ============================================ */
.dropdown-menu {
    position: absolute;
    z-index: 50;
    min-width: 12rem;
    padding: 0.25rem;
    background: white;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--color-gray-700);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--color-gray-100);
}

.dropdown-item-danger {
    color: #dc2626;
}

.dropdown-item-danger:hover {
    background: #fee2e2;
}

.dropdown-divider {
    height: 1px;
    margin: 0.25rem 0;
    background: var(--color-gray-200);
}


/* ============================================
   Components: Tabs
   ============================================ */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--color-gray-200);
}

.tab {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    cursor: pointer;
}

.tab:hover {
    color: var(--color-gray-700);
}

.tab.active {
    color: #18181b; /* zinc-900 */
    border-bottom-color: #18181b;
}


/* ============================================
   Utilities: Scrollbar
   ============================================ */
.scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: var(--color-gray-300) transparent;
}

.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

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

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}


/* ============================================
   Utilities: Transitions
   ============================================ */
.transition-fast { transition: all var(--transition-fast); }
.transition-base { transition: all var(--transition-base); }
.transition-slow { transition: all var(--transition-slow); }


/* ============================================
   Page-Specific: Editor
   ============================================ */
.editor-container {
    display: flex;
    height: calc(100vh - var(--header-height));
}

.editor-sidebar {
    width: 18rem;
    flex-shrink: 0;
    border-right: 1px solid var(--color-gray-200);
    overflow-y: auto;
}

.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-toolbar {
    height: 3.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    border-bottom: 1px solid var(--color-gray-200);
    background: white;
}

.editor-panes {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-code {
    flex: 1;
    overflow: auto;
    border-right: 1px solid var(--color-gray-200);
}

.editor-preview {
    flex: 1;
    overflow: hidden;
    background: white;
}

.editor-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
}


/* ============================================
   Page-Specific: Review (Public)
   ============================================ */
.review-pin {
    position: absolute;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-600);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%, -50%);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
    z-index: 10;
}

.review-pin:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.review-pin.active {
    background: #dc2626;
}

.review-pin.resolved {
    background: #16a34a;
}
