/* ============================================
   NQ Tenpin Opening Hours Widget
   Dark Theme • Modern • Stunning UI
   ============================================ */

/* === CSS Custom Properties === */
:root {
    /* Primary Palette */
    --widget-primary: #00D4FF;
    --widget-primary-rgb: 0, 212, 255;
    --widget-secondary: #6366F1;
    --widget-secondary-rgb: 99, 102, 241;
    
    /* Background Tones */
    --widget-bg-deep: #0A0A0F;
    --widget-bg-card: #111118;
    --widget-bg-elevated: #18181F;
    --widget-bg-hover: #1F1F28;
    
    /* Status Colors */
    --widget-success: #00FF88;
    --widget-success-rgb: 0, 255, 136;
    --widget-warning: #FFAA00;
    --widget-warning-rgb: 255, 170, 0;
    --widget-error: #FF3366;
    --widget-error-rgb: 255, 51, 102;
    
    /* Text Hierarchy */
    --widget-text-primary: #FFFFFF;
    --widget-text-secondary: #B0B0C0;
    --widget-text-muted: #606070;
    
    /* Borders & Dividers */
    --widget-border: rgba(255, 255, 255, 0.06);
    --widget-border-accent: rgba(0, 212, 255, 0.3);
    
    /* Typography */
    --font-display: 'Outfit', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'DM Sans', 'SF Pro Text', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Font Imports === */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* === Base Reset === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === Widget Container === */
.nqt-hours-widget {
    font-family: var(--font-body);
    background: var(--widget-bg-deep);
    color: var(--widget-text-primary);
    min-height: 100%;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}

/* Gradient Background */
.nqt-hours-widget::before {
    content: '';
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(var(--widget-primary-rgb), 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.nqt-hours-widget > * {
    position: relative;
    z-index: 1;
}

/* === Hero Status Section === */
.nqt-status-hero {
    text-align: center;
    padding: var(--space-md) var(--space-md);
    margin-bottom: var(--space-md);
    background: linear-gradient(180deg, var(--widget-bg-card) 0%, var(--widget-bg-deep) 100%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--widget-border);
    position: relative;
    overflow: hidden;
}

/* Clock Icon */
.nqt-clock-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-sm);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--widget-bg-elevated);
    border: 2px solid var(--widget-border);
    transition: all var(--transition-base);
}

.nqt-clock-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--widget-text-secondary);
    transition: all var(--transition-base);
}

/* Open State */
[data-status="open"] .nqt-clock-icon {
    border-color: var(--widget-success);
    box-shadow: 0 0 30px rgba(var(--widget-success-rgb), 0.3), inset 0 0 20px rgba(var(--widget-success-rgb), 0.1);
    animation: pulse-glow-success 2.5s ease-in-out infinite;
}

[data-status="open"] .nqt-clock-icon svg {
    stroke: var(--widget-success);
}

/* Closed State */
[data-status="closed"] .nqt-clock-icon {
    border-color: var(--widget-error);
    box-shadow: 0 0 30px rgba(var(--widget-error-rgb), 0.2);
}

[data-status="closed"] .nqt-clock-icon svg {
    stroke: var(--widget-error);
}

@keyframes pulse-glow-success {
    0%, 100% { box-shadow: 0 0 30px rgba(var(--widget-success-rgb), 0.3), inset 0 0 20px rgba(var(--widget-success-rgb), 0.1); }
    50% { box-shadow: 0 0 50px rgba(var(--widget-success-rgb), 0.5), inset 0 0 30px rgba(var(--widget-success-rgb), 0.15); }
}

/* Status Badge */
.nqt-status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.nqt-status-badge[data-status="open"] {
    color: var(--widget-success);
}

.nqt-status-badge[data-status="closed"] {
    color: var(--widget-error);
}

/* Status Dot */
.nqt-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.nqt-status-badge[data-status="open"] .nqt-status-dot {
    background: var(--widget-success);
    box-shadow: 0 0 12px var(--widget-success);
    animation: pulse-dot 2s ease-in-out infinite;
}

.nqt-status-badge[data-status="closed"] .nqt-status-dot {
    background: var(--widget-error);
    box-shadow: 0 0 8px var(--widget-error);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.15); }
}

/* Status Message */
.nqt-status-message {
    font-size: 1.1rem;
    color: var(--widget-text-secondary);
    margin-bottom: var(--space-xs);
}

/* Countdown */
.nqt-countdown {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--widget-text-muted);
}

.nqt-countdown-value {
    color: var(--widget-primary);
    font-weight: 500;
}

/* === Weekly Hours Section === */
.nqt-hours-section {
    margin-bottom: var(--space-md);
}

/* Hours List */
.nqt-hours-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--widget-bg-card);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--widget-border);
    border-top: none;
}

/* Hours Header */
.nqt-hours-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    background: var(--widget-bg-elevated);
    border: 1px solid var(--widget-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nqt-header-label {
    color: var(--widget-text-muted);
}

.nqt-header-booking {
    color: var(--widget-primary);
}

/* Individual Day Row */
.nqt-day-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--widget-bg-card);
    transition: background var(--transition-fast);
}

.nqt-day-row:hover {
    background: var(--widget-bg-hover);
}

/* Today Highlight */
.nqt-day-row.is-today {
    background: linear-gradient(90deg, rgba(var(--widget-primary-rgb), 0.1) 0%, var(--widget-bg-card) 100%);
    border-left: 3px solid var(--widget-primary);
    padding-left: calc(var(--space-lg) - 3px);
}

/* Day Name Column */
.nqt-day-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nqt-day-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--widget-text-primary);
    min-width: 100px;
}

.nqt-today-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    background: var(--widget-primary);
    color: var(--widget-bg-deep);
    border-radius: var(--radius-full);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Hours Column */
.nqt-day-hours {
    text-align: right;
}

.nqt-venue-hours {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--widget-text-primary);
    margin-bottom: 2px;
}

.nqt-booking-hours {
    font-size: 0.75rem;
    color: var(--widget-primary);
}

/* Closed Day Styling - Red for visibility */
.nqt-day-row.is-closed {
    opacity: 1;
    background: rgba(255, 51, 102, 0.1);
    border-left: 3px solid var(--widget-error);
    padding-left: calc(var(--space-lg) - 3px);
}

.nqt-day-row.is-closed .nqt-day-name {
    color: var(--widget-text-secondary);
}

.nqt-day-row.is-closed .nqt-venue-hours {
    color: var(--widget-error);
    font-weight: 600;
}

.nqt-day-row.is-closed .nqt-booking-hours {
    display: none;
}

/* Sunday Special Indicator */
.nqt-day-row.is-sunday .nqt-day-name::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--widget-warning);
    border-radius: 50%;
    margin-left: var(--space-sm);
    vertical-align: middle;
}

/* === Special Events Panel === */
.nqt-events-panel {
    background: var(--widget-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--widget-border);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.nqt-events-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--widget-text-primary);
    transition: all var(--transition-fast);
    font-family: var(--font-body);
}

.nqt-events-toggle:hover {
    background: var(--widget-bg-hover);
}

.nqt-events-toggle-content {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nqt-events-toggle-content svg {
    width: 18px;
    height: 18px;
    stroke: var(--widget-warning);
}

.nqt-events-toggle-content .nqt-events-label {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--widget-text-muted);
}

.nqt-events-count {
    background: rgba(var(--widget-warning-rgb), 0.2);
    color: var(--widget-warning);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.nqt-events-chevron {
    width: 20px;
    height: 20px;
    stroke: var(--widget-text-muted);
    transition: transform var(--transition-base);
}

.nqt-events-panel[data-expanded="true"] .nqt-events-chevron {
    transform: rotate(180deg);
}

/* Events List */
.nqt-events-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.nqt-events-panel[data-expanded="true"] .nqt-events-list {
    max-height: 400px;
}

.nqt-event-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--widget-border);
}

.nqt-event-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nqt-event-icon svg {
    width: 18px;
    height: 18px;
}

.nqt-event-icon.type-holiday {
    background: rgba(var(--widget-error-rgb), 0.15);
}
.nqt-event-icon.type-holiday svg {
    stroke: var(--widget-error);
}

.nqt-event-icon.type-private {
    background: rgba(var(--widget-warning-rgb), 0.15);
}
.nqt-event-icon.type-private svg {
    stroke: var(--widget-warning);
}

.nqt-event-content {
    flex: 1;
}

.nqt-event-title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--widget-text-primary);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.nqt-event-datetime {
    font-size: 0.8rem;
    color: var(--widget-text-muted);
}

/* No Events */
.nqt-no-events {
    padding: var(--space-lg);
    text-align: center;
    color: var(--widget-text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--widget-border);
}

.nqt-no-events svg {
    width: 24px;
    height: 24px;
    stroke: var(--widget-success);
    margin-bottom: var(--space-sm);
    opacity: 0.6;
}

/* === Quick Actions === */
.nqt-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.nqt-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
}

.nqt-action-btn svg {
    width: 18px;
    height: 18px;
}

/* Primary - Book Now */
.nqt-action-btn.primary {
    background: linear-gradient(135deg, var(--widget-primary) 0%, var(--widget-secondary) 100%);
    color: var(--widget-bg-deep);
    box-shadow: 0 4px 20px rgba(var(--widget-primary-rgb), 0.3);
}

.nqt-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(var(--widget-primary-rgb), 0.4);
}

/* Disabled - Coming Soon */
.nqt-action-btn.primary.disabled {
    background: linear-gradient(135deg, #3a3a4a 0%, #2a2a35 100%);
    color: var(--widget-text-muted);
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.7;
}

.nqt-action-btn.primary.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Secondary - Call Us */
.nqt-action-btn.secondary {
    background: var(--widget-bg-elevated);
    color: var(--widget-text-primary);
    border: 1px solid var(--widget-border);
}

.nqt-action-btn.secondary:hover {
    background: var(--widget-bg-hover);
    border-color: var(--widget-primary);
    color: var(--widget-primary);
}

/* === Footer === */
.nqt-widget-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--widget-text-muted);
}

.nqt-refresh-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: transparent;
    border: 1px solid var(--widget-border);
    border-radius: var(--radius-sm);
    color: var(--widget-text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-body);
    transition: all var(--transition-fast);
}

.nqt-refresh-btn:hover {
    border-color: var(--widget-primary);
    color: var(--widget-primary);
}

.nqt-refresh-btn svg {
    width: 12px;
    height: 12px;
}

.nqt-refresh-btn.is-loading svg {
    animation: spin 1s linear infinite;
}

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

/* === Loading Skeleton === */
.nqt-skeleton {
    background: linear-gradient(90deg, var(--widget-bg-elevated) 25%, var(--widget-bg-hover) 50%, var(--widget-bg-elevated) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

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

/* === Error State === */
.nqt-error-state {
    text-align: center;
    padding: var(--space-xl);
}

.nqt-error-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--widget-error);
    margin-bottom: var(--space-md);
}

.nqt-error-state h3 {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--widget-text-primary);
    margin-bottom: var(--space-sm);
}

.nqt-error-state p {
    color: var(--widget-text-muted);
    font-size: 0.9rem;
}

/* === Responsive === */
@media (max-width: 400px) {
    .nqt-hours-widget {
        padding: var(--space-md);
    }
    
    .nqt-day-row {
        padding: var(--space-sm) var(--space-md);
    }
    
    .nqt-day-name {
        min-width: 80px;
        font-size: 0.9rem;
    }
    
    .nqt-venue-hours {
        font-size: 0.95rem;
    }
    
    .nqt-actions {
        grid-template-columns: 1fr;
    }
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.nqt-action-btn:focus-visible,
.nqt-events-toggle:focus-visible,
.nqt-refresh-btn:focus-visible {
    outline: 2px solid var(--widget-primary);
    outline-offset: 2px;
}

/* === Page-Level Styles (Standalone Viewing) === */
html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: #0A0A0F;
}

body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
}

/* Full-page embed mode */
body.embed-mode {
    padding: 0;
}

body.embed-mode .nqt-hours-widget {
    max-width: none;
    border-radius: 0;
}

/* Iframe-specific optimizations */
@media (max-height: 600px) {
    body {
        padding: 0.5rem;
    }
}

/* Noscript fallback */
.nqt-noscript-fallback {
    padding: 2rem;
    text-align: center;
    color: #A0A0B0;
}

.nqt-noscript-fallback p + p {
    margin-top: 1rem;
}