/* YourBizGuru Tools - Shared Base Styles - Tokenized Theme System */

/* ========================================
   THEME TOKEN SYSTEM
   ======================================== */

/* Default tokens (Light theme) */
:root {
    /* Brand Colors - Constants across themes */
    --ybg-brand-primary: 8, 145, 178;  /* Deep Teal RGB (cyan-600) */
    --ybg-brand-accent: 16, 185, 129;  /* Emerald Green RGB (emerald-500) */
    --ybg-brand-success: 34, 197, 94;  /* Success Green RGB */
    --ybg-brand-error: 244, 67, 54;    /* Red RGB */
    
    /* Typography - Constants */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Open Sans', sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 28px;
    
    /* Spacing - Constants */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Layout - Constants */
    --max-width: 1200px;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    
    /* Light Theme Tokens (Default) */
    --bg: 240, 253, 250;                /* Very pale teal-cyan */
    --bg-gradient: linear-gradient(180deg, #e0f2fe 0%, #ffffff 55%, #ecfeff 100%);
    --bg-accent-wash: radial-gradient(1200px 820px at 90% -140px, rgba(var(--ybg-brand-accent), 0.15), rgba(255, 255, 255, 0) 58%);
    --bg-accent-wash-2: radial-gradient(900px 700px at -10% 110%, rgba(var(--ybg-brand-primary), 0.15), rgba(255, 255, 255, 0) 60%);
    --card: 255, 255, 255;              /* Pure white cards */
    --card-gradient: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    --card-header: 245, 247, 250;       /* Slightly tinted header */
    --card-border: rgba(17, 24, 39, 0.08);  /* Subtle slate border */
    --panel: 255, 255, 255;              /* Panel background */
    --panel-tint: linear-gradient(180deg, rgba(79, 195, 247, 0.12) 0%, rgba(255, 255, 255, 0.0) 50%);
    --panel-sheen: linear-gradient(0deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85));
    --panel-border: rgba(17, 24, 39, 0.15);
    --panel-shadow: 0 8px 28px rgba(16, 24, 40, 0.12);
    --rim-gradient: linear-gradient(180deg, rgba(79, 195, 247, 0.18), rgba(79, 195, 247, 0.00));
    --text: 51, 51, 51;                  /* Darker gray #333 for better contrast */
    --text-secondary: 100, 116, 139;    /* Slate gray */
    --text-muted: 148, 163, 184;        /* Light slate */
    --border: 226, 232, 240;             /* Soft border */
    --border-strong: 203, 213, 225;      /* Stronger border */
    --divider-fade: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(17, 24, 39, 0.10), rgba(0, 0, 0, 0));
    --panel-header-glow: 0 0 12px rgba(79, 195, 247, 0.12);
    
    /* Interactive Colors */
    --primary: rgb(var(--ybg-brand-primary));
    --primary-rgb: var(--ybg-brand-primary);
    --accent: rgb(var(--ybg-brand-accent));
    --accent-rgb: var(--ybg-brand-accent);
    --success: rgb(var(--ybg-brand-success));
    --error: rgb(var(--ybg-brand-error));
    
    /* Gradients */
    --btn-gradient: linear-gradient(90deg, rgb(var(--primary-rgb)), rgb(33, 150, 243));
    --btn-gradient-hover: linear-gradient(90deg, rgb(var(--primary-rgb)), rgb(41, 182, 246));
    
    /* Shadows & Glows */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-strong: 0 20px 25px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.04);
    --glow-primary: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
    --glow-accent: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
    --glow-accent-strong: 0 0 10px rgba(var(--accent-rgb), 0.4);
    
    /* Accent Hints */
    --accent-border-alpha: rgba(var(--accent-rgb), 0.2);
    --accent-glow-alpha: rgba(var(--accent-rgb), 0.3);
    --accent-marker: 2px solid rgba(var(--accent-rgb), 0.4);
}

/* Dark Theme Tokens */
html.theme-dark {
    /* Dark Theme Colors */
    --bg: 10, 10, 10;                   /* Near black */
    --bg-gradient: linear-gradient(135deg, #0A0A0A, #1A1A1A, #0f0f0f);
    --card: 26, 26, 26;                  /* Slightly lighter than before */
    --card-header: 35, 35, 35;          /* Card header bg */
    --panel: 30, 30, 30;                 /* Panel background */
    --text: 240, 240, 240;               /* Lighter gray #f0f0f0 for better contrast */
    --text-secondary: 200, 200, 200;    /* Light gray */
    --text-muted: 150, 150, 150;        /* Muted gray */
    --border: 79, 195, 247;              /* Blue border with alpha */
    --border-strong: 79, 195, 247;       /* Stronger blue border */
    
    /* Dark theme shadows & glows */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.7);
    --shadow-strong: 0 16px 32px rgba(0, 0, 0, 0.8);
    --glow-primary: 0 0 10px rgba(var(--primary-rgb), 0.7);
    --glow-accent: 0 0 15px rgba(var(--accent-rgb), 0.6);
    --glow-accent-strong: 0 0 20px rgba(var(--accent-rgb), 0.9);
    
    /* Enhanced accent presence */
    --accent-border-alpha: rgba(var(--accent-rgb), 0.3);
    --accent-glow-alpha: rgba(var(--accent-rgb), 0.5);
    --accent-marker: 3px solid rgba(var(--accent-rgb), 0.5);
}

/* ========================================
   BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Default to light theme */
    background: var(--bg-gradient);
}

body {
    background: var(--bg-gradient);
    color: rgb(var(--text));
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Light theme background with dual accent wash */
html.theme-light,
html:not(.theme-dark) {
    background:
        var(--bg-accent-wash),
        var(--bg-accent-wash-2),
        var(--bg-gradient);
    background-attachment: fixed;
}

html.theme-light body,
html:not(.theme-dark) body {
    background: transparent;
}

/* ========================================
   LAYOUT
   ======================================== */

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ========================================
   HEADER
   ======================================== */

.app-header {
    padding: 0;
    border-bottom: 1px solid rgba(var(--border), 0.2);
    margin-bottom: var(--spacing-xs);
    margin-left: calc(var(--spacing-md) * -1);
    margin-right: calc(var(--spacing-md) * -1);
    padding-right: var(--spacing-md);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding-left: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-left: auto;
}

.logo {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), 0.4));
    transition: filter 0.3s ease;
}

.logo:hover {
    filter: drop-shadow(0 0 12px rgba(var(--accent-rgb), 0.6));
}

/* Title with yellow accent dot */
.app-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: rgb(var(--text));
    position: relative;
    padding-right: var(--spacing-md);
}

.app-title::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.6);
}

.title-container {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.app-tagline {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: rgb(var(--text-secondary));
    margin: 0;
}

/* Dark theme heading glow */
html.theme-dark h1,
html.theme-dark h2,
html.theme-dark h3 {
    text-shadow: 0 0 6px rgba(var(--primary-rgb), 0.4);
}

/* ========================================
   THEME TOGGLE
   ======================================== */

.theme-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 16px;
    background: rgba(var(--card), 0.8);
    border: 1px solid rgba(var(--border), 0.3);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    color: rgb(var(--text));
}

/* Light theme: visible border + gradient on theme toggle */
html.theme-light .theme-toggle,
html:not(.theme-dark) .theme-toggle {
    border: 1.5px solid rgba(100, 116, 139, 0.3);
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(247, 250, 252, 0.95) 100%);
    box-shadow: 0 2px 4px rgba(16, 24, 40, 0.08);
}

.theme-toggle:hover {
    background: rgba(var(--card), 1);
    border-color: rgba(var(--primary-rgb), 0.4);
    box-shadow: var(--glow-primary);
}

.theme-toggle:active {
    transform: scale(0.98);
}

.theme-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(20deg);
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

/* ========================================
   PANELS & CARDS
   ======================================== */

.panel {
    background: rgba(var(--card), 0.95);
    border: 1px solid rgba(var(--border), 0.2);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    /* Make panel a flex container to allow content to fill height */
    display: flex;
    flex-direction: column;
}

/* Light theme panel "Less White" polish */
html.theme-light .panel,
html:not(.theme-dark) .panel {
    background:
        var(--panel-sheen),
        var(--panel-tint),
        var(--card-gradient);
    border: 1px solid transparent;
    border-image: var(--rim-gradient) 1;
    border-image-slice: 1;
    box-shadow: var(--panel-shadow);
    backdrop-filter: none;
    /* Fallback border for older browsers */
    border-color: var(--panel-border);
}

/* Light theme: subtle yellow accent marker on cards */
html:not(.theme-dark) .panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.4), transparent);
}

/* Light theme: enhanced borders and shadows on results panel */
html.theme-light .results-panel,
html:not(.theme-dark) .results-panel {
    border: 2px solid rgba(100, 116, 139, 0.2);
    border-image: none; /* Override inherited border-image from .panel */
    box-shadow: 
        0 0 0 1px rgba(79, 195, 247, 0.15) inset,
        0 8px 24px rgba(16, 24, 40, 0.1),
        0 4px 12px rgba(79, 195, 247, 0.08);
}

/* Light theme: stronger yellow accent bar on results panel */
html.theme-light .results-panel::before,
html:not(.theme-dark) .results-panel::before {
    height: 3px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(var(--accent-rgb), 0.6), 
        transparent);
}

/* Dark theme: enhanced yellow accent on results panel */
html.theme-dark .results-panel {
    border-color: rgba(var(--primary-rgb), 0.3);
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.2), var(--shadow);
}

html.theme-dark .results-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.5), transparent);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: rgba(var(--card-header), 0.5);
    border-bottom: 1px solid rgba(var(--border), 0.15);
}

.results-header-content {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
}

/* Light theme panel header "Less White" polish */
html.theme-light .panel-header,
html:not(.theme-dark) .panel-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 251, 255, 0.8) 100%);
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 0 0 0 rgba(0, 0, 0, 0);
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: rgb(var(--text));
}

.panel-actions {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

/* Ensure Clear button always has transparent background */
.panel-actions .clear-btn {
    background: transparent !important;
}

.panel-content {
    padding: var(--spacing-xl);
    /* Allow panel content to grow and fill available space */
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* ========================================
   FORMS
   ======================================== */

.toolkit-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-label {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: rgb(var(--text));
}

.keyboard-hint {
    font-size: var(--font-size-xs);
    font-weight: 400;
    color: rgb(var(--text-muted));
    font-style: italic;
}

.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid rgba(var(--border), 0.5);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: rgb(var(--text));
    background: rgba(var(--bg), 0.5);
    resize: vertical;
    min-height: 140px;
    transition: all 0.3s ease;
}

/* Light theme: stronger textarea border + gradient */
html.theme-light .form-textarea,
html:not(.theme-dark) .form-textarea {
    border: 1.5px solid rgba(100, 116, 139, 0.25);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(247, 250, 252, 0.95) 100%);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

.form-textarea::placeholder {
    color: rgb(var(--text-muted));
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid rgba(var(--border), 0.5);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    color: rgb(var(--text));
    background: rgba(var(--bg), 0.5);
    transition: all 0.3s ease;
}

/* Light theme: stronger borders + gradient backgrounds */
html.theme-light .form-input,
html.theme-light .form-select,
html:not(.theme-dark) .form-input,
html:not(.theme-dark) .form-select {
    border: 1.5px solid rgba(100, 116, 139, 0.25);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(247, 250, 252, 0.95) 100%);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-input::placeholder {
    color: rgb(var(--text-muted));
}

.required-marker {
    color: rgb(var(--ybg-brand-error));
    font-weight: bold;
}

.error-message {
    font-size: var(--font-size-sm);
    color: rgb(var(--ybg-brand-error));
    min-height: 20px;
    display: block;
    margin-top: 4px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(var(--card), 0.5);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(var(--border), 0.2);
}

/* Light theme: stronger border + gradient on checkbox group */
html.theme-light .checkbox-group,
html:not(.theme-dark) .checkbox-group {
    border: 1.5px solid rgba(100, 116, 139, 0.2);
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.85) 0%, 
        rgba(247, 250, 252, 0.9) 100%);
    box-shadow: 0 2px 4px rgba(16, 24, 40, 0.06);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: var(--font-size-base);
    color: rgb(var(--text));
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.checkbox-label:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Enhanced focus states with blue core and yellow halo */
.form-textarea:focus,
.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.3), 0 0 0 5px rgba(var(--accent-rgb), 0.1);
}

/* Dark theme input enhancements */
html.theme-dark .form-textarea,
html.theme-dark .form-input,
html.theme-dark .form-select {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(var(--primary-rgb), 0.3);
}

html.theme-dark .form-textarea:focus,
html.theme-dark .form-input:focus,
html.theme-dark .form-select:focus {
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.6), 0 0 12px rgba(var(--accent-rgb), 0.2);
}

html.theme-dark .checkbox-group {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(var(--primary-rgb), 0.2);
}

/* ========================================
   BUTTONS
   ======================================== */

.submit-btn {
    padding: 14px 28px;
    background: var(--btn-gradient);
    color: #000;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-height: 48px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Loading spinner for buttons */
.submit-btn.loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Light theme button with inner highlight */
html.theme-light .submit-btn,
html:not(.theme-dark) .submit-btn {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Light theme button hover: enhanced yellow cue */
html.theme-light .submit-btn:hover,
html:not(.theme-dark) .submit-btn:hover {
    background: var(--btn-gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px rgba(var(--ybg-brand-accent), 0.18) inset, 0 0 0 1px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 8px rgba(var(--primary-rgb), 0.3);
}

/* Dark theme button hover: dual-layer glow (blue + yellow) */
html.theme-dark .submit-btn {
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}

html.theme-dark .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 0 10px rgba(var(--primary-rgb), 0.7),
        0 0 20px rgba(var(--accent-rgb), 0.6),
        0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

.submit-btn:active {
    transform: scale(0.98);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.clear-btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.clear-btn:hover {
    background: var(--primary);
    color: rgb(var(--bg));
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.4);
}

.action-btn {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.5);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    background: var(--primary);
    color: rgb(var(--bg));
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.4);
}

/* Dropdown Menu Styles */
.menu-dropdown {
    position: relative;
    display: inline-block;
}

.menu-dropdown .menu-btn {
    display: flex;
    align-items: center;
    gap: 4px;
}

.menu-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: rgb(var(--card));
    border: 1px solid rgba(var(--border), 0.3);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
}

.menu-content.show {
    display: block;
    animation: menuFadeIn 0.15s ease;
}

.menu-content button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    color: rgb(var(--text));
    border: none;
    text-align: left;
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.menu-content button:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   RESULTS
   ======================================== */

.results-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    overflow-y: auto;
    /* On desktop: fill available height. On mobile: limit height */
    flex: 1;
    min-height: 0;
}

/* Mobile: keep reasonable max-height for better UX */
@media (max-width: 767px) {
    .results-container {
        max-height: 600px;
        flex: initial;
    }
}

/* Custom scrollbar */
.results-container::-webkit-scrollbar {
    width: 8px;
}

.results-container::-webkit-scrollbar-track {
    background: rgba(var(--bg), 0.3);
    border-radius: 4px;
}

.results-container::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.3);
    border-radius: 4px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.5);
}

.no-results {
    text-align: center;
    color: rgb(var(--text-muted));
    font-style: italic;
    padding: var(--spacing-xl);
}

.result-item {
    border: 1px solid rgba(var(--border), 0.2);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-md);
    background: rgba(var(--card), 0.5);
    transition: all 0.3s ease;
}

.result-item:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(var(--primary-rgb), 0.3);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(var(--border), 0.1);
}

.result-timestamp {
    font-size: var(--font-size-xs);
    color: rgb(var(--text-muted));
    font-family: var(--font-body);
}

.result-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.result-content {
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: rgb(var(--text));
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    text-align: center;
    padding: var(--spacing-lg);
    color: rgb(var(--text-secondary));
    font-size: var(--font-size-sm);
    border-top: 2px solid rgba(var(--border), 0.3);
    transition: all 0.3s ease;
    position: relative;
    background: rgba(var(--card), 0.5);
    border-radius: 12px;
    margin-top: var(--spacing-md);
}

/* Subtle top divider line for separation */
.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.2), transparent);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.footer-disclaimer {
    font-size: var(--font-size-xs);
    color: rgb(var(--text-muted));
    font-style: italic;
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid rgba(var(--border), 0.1);
    font-weight: 400;
}

.footer a {
    color: rgb(var(--text));
    text-decoration: none;
    margin: 0 6px;
    transition: all 0.15s ease;
    position: relative;
    font-weight: 500;
}

/* Light theme: enhanced yellow hover underline */
html.theme-light .footer a:hover,
html:not(.theme-dark) .footer a:hover {
    color: var(--primary);
    text-decoration: none;
}

html:not(.theme-dark) .footer a:hover::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 4px rgba(var(--accent-rgb), 0.6);
}

/* Dark theme: primary hover color */
html.theme-dark .footer a:hover {
    color: var(--primary);
    text-decoration: none;
}

/* ========================================
   DIVIDERS
   ======================================== */

hr,
.divider {
    height: 1px;
    background: var(--divider-fade);
    border: 0;
    opacity: 0.6;
    margin: var(--spacing-md) 0;
}

/* ========================================
   UTILITIES
   ======================================== */

.hidden {
    display: none !important;
}

/* ========================================
   LOADING STATES
   ======================================== */

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus states for keyboard navigation */
.form-textarea:focus,
.submit-btn:focus,
.clear-btn:focus,
.action-btn:focus,
.theme-toggle:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-strong: 0 4px 8px rgba(0, 0, 0, 0.5);
    }
    
    html.theme-dark {
        --border: 255, 255, 255;
        --text: 255, 255, 255;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .theme-icon {
        transform: none !important;
    }
    
    /* Disable glows in reduced motion */
    .submit-btn,
    .form-textarea:focus,
    .theme-toggle:hover {
        box-shadow: none !important;
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* === Accessibility Utilities === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* === Themed Select Component === */
.ybg-select {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  border-radius: var(--border-radius-sm);
  padding: 6px 28px 6px 12px;
  font-family: var(--font-body);
  font-size: var(--font-size-xs);
  font-weight: 500;
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(var(--primary-rgb), 0.5);
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px 12px;
  transition: all 0.15s ease;
  cursor: pointer;
}

/* Chevron icon (inline SVG) - matches button theme */
.ybg-select {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="%234FC3F7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 8 10 12 14 8"/></svg>');
}

.ybg-select:hover {
  background-color: var(--primary);
  color: rgb(var(--bg));
  box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.4);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 8 10 12 14 8"/></svg>');
}

.ybg-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (max-width: 768px) {
    .app-container {
        padding: 0 var(--spacing-sm);
    }
    
    .logo {
        height: 44px;
    }
    
    .app-title {
        font-size: var(--font-size-sm);
    }
    
    .app-tagline {
        font-size: 10px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .panel-header {
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .panel-content {
        padding: var(--spacing-lg);
    }
    
    .toolkit-form {
        gap: var(--spacing-lg);
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }
    
    .result-actions {
        align-self: flex-end;
    }
    
    .footer {
        padding-bottom: var(--spacing-xl);
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 0 var(--spacing-xs);
    }
    
    .header-left {
        gap: var(--spacing-xs);
    }
    
    .logo {
        height: 40px;
        width: auto;
    }
    
    .app-title {
        font-size: var(--font-size-xs);
    }
    
    .app-tagline {
        font-size: 9px;
    }
    
    .theme-toggle {
        font-size: 11px;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .panel-header {
        padding: var(--spacing-md);
    }
    
    .panel-content {
        padding: var(--spacing-md);
    }
    
    .form-textarea {
        min-height: 120px;
    }
}

/* ========================================
   COMPLIANCE RESULT STYLES
   ======================================== */

/* Document metadata header */
.doc-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: rgba(var(--card-header), 0.3);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-sm);
}

.doc-meta div {
    display: flex;
    flex-direction: column;
}

.doc-meta strong {
    color: rgb(var(--text-secondary));
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* Section containers */
.compliance-section {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid rgba(var(--border), 0.15);
}

.compliance-section:last-child {
    border-bottom: none;
}

.section-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: rgb(var(--text));
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.2);
}

.section-content {
    font-size: var(--font-size-base);
    line-height: 1.7;
    color: rgb(var(--text));
}

.section-content p {
    margin-bottom: var(--spacing-md);
}

/* Recommendations list - disable default numbering since JS adds manual numbers */
ol.recs {
    list-style: none;
    padding-left: 0;
}

ol.recs li {
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-xs);
}

/* Checklist styles */
.compliance-section .checklist li[title] {
    cursor: help;
    border-bottom: 1px dotted rgba(var(--primary-rgb), 0.3);
    padding-bottom: 2px;
    transition: border-color 0.2s ease;
}

.compliance-section .checklist li[title]:hover {
    border-bottom-color: rgba(var(--primary-rgb), 0.6);
}

.checklist-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.checklist-category {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: rgb(var(--text));
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.checklist-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    background: rgba(var(--card), 0.5);
    transition: background 0.2s ease;
}

.checklist-item:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.checklist-item.checked {
    background: rgba(var(--ybg-brand-success), 0.1);
}

.checklist-item.suggested-item {
    border-left: 3px solid rgba(var(--accent-rgb), 0.5);
}

.checkbox-icon {
    font-size: var(--font-size-lg);
    color: rgb(var(--text));
    flex-shrink: 0;
    margin-top: 2px;
}

.checklist-item.checked .checkbox-icon {
    color: rgb(var(--ybg-brand-success));
}

.item-details {
    flex: 1;
}

.item-label {
    font-size: var(--font-size-base);
    font-weight: 500;
    color: rgb(var(--text));
    margin-bottom: 4px;
}

.item-description {
    font-size: var(--font-size-sm);
    color: rgb(var(--text-secondary));
    line-height: 1.5;
}

/* Table styles */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(var(--border), 0.2);
}

.compliance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.compliance-table thead {
    background: rgba(var(--card-header), 0.8);
}

.compliance-table th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: rgb(var(--text));
    border-bottom: 2px solid rgba(var(--border), 0.3);
}

.compliance-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    color: rgb(var(--text));
    border-bottom: 1px solid rgba(var(--border), 0.1);
}

.compliance-table tbody tr:last-child td {
    border-bottom: none;
}

/* Zebra striping for tables */
.compliance-table tbody tr:nth-child(even) {
    background: rgba(var(--card), 0.3);
}

.compliance-table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

/* Severity badges */
.severity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: capitalize;
}

.severity-badge.high {
    background: rgba(var(--ybg-brand-error), 0.15);
    color: rgb(var(--ybg-brand-error));
    border: 1.5px solid rgba(var(--ybg-brand-error), 0.3);
}

.severity-badge.medium {
    background: rgba(var(--accent-rgb), 0.2);
    color: rgb(var(--text));
    border: 1.5px solid rgba(var(--accent-rgb), 0.35);
}

.severity-badge.low {
    background: rgba(var(--ybg-brand-success), 0.15);
    color: rgb(var(--ybg-brand-success));
    border: 1.5px solid rgba(var(--ybg-brand-success), 0.3);
}

/* Light theme: gradient backgrounds + stronger borders on badges */
html.theme-light .severity-badge.high,
html:not(.theme-dark) .severity-badge.high {
    background: linear-gradient(135deg, 
        rgba(244, 67, 54, 0.12) 0%, 
        rgba(255, 255, 255, 0.85) 100%);
    border-color: rgba(var(--ybg-brand-error), 0.5);
    box-shadow: 0 1px 3px rgba(244, 67, 54, 0.15);
}

html.theme-light .severity-badge.medium,
html:not(.theme-dark) .severity-badge.medium {
    background: linear-gradient(135deg, 
        rgba(255, 235, 59, 0.18) 0%, 
        rgba(255, 255, 255, 0.85) 100%);
    border-color: rgba(var(--accent-rgb), 0.5);
    box-shadow: 0 1px 3px rgba(255, 235, 59, 0.2);
}

html.theme-light .severity-badge.low,
html:not(.theme-dark) .severity-badge.low {
    background: linear-gradient(135deg, 
        rgba(76, 175, 80, 0.12) 0%, 
        rgba(255, 255, 255, 0.85) 100%);
    border-color: rgba(var(--ybg-brand-success), 0.5);
    box-shadow: 0 1px 3px rgba(76, 175, 80, 0.15);
}

/* Recommendations list */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.recommendation-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-sm);
    background: rgba(var(--card), 0.5);
    border-left: 3px solid rgba(var(--primary-rgb), 0.5);
}

.rec-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #000;
    border-radius: 50%;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.rec-content {
    flex: 1;
}

.rec-action {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: rgb(var(--text));
    margin-bottom: 4px;
}

.rec-detail {
    font-size: var(--font-size-sm);
    color: rgb(var(--text-secondary));
    line-height: 1.6;
}

/* References list */
.references-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.reference-item {
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    background: rgba(var(--card), 0.5);
}

.reference-item strong {
    color: rgb(var(--text));
    font-weight: 600;
}

.reference-item a {
    color: var(--primary);
    text-decoration: none;
    word-break: break-all;
}

.reference-item a:hover {
    text-decoration: underline;
}

.ref-description {
    font-size: var(--font-size-sm);
    color: rgb(var(--text-secondary));
    margin-top: 4px;
    font-style: italic;
}

.disclaimer {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(var(--accent-rgb), 0.1);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid rgba(var(--accent-rgb), 0.5);
    font-size: var(--font-size-sm);
    color: rgb(var(--text-secondary));
}

.disclaimer strong {
    color: rgb(var(--text));
}

/* ========================================
   MODAL STYLES
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: rgb(var(--text-muted));
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
    z-index: 10;
}

.modal-close:hover {
    color: rgb(var(--text));
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .theme-toggle,
    .clear-btn,
    .action-btn,
    .submit-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}