/* ============================================
   CSS VARIABLES - Claude.ai Branding
   ============================================ */

:root {
    /* Claude.ai Light Mode Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e8e8e8;
    --text-primary: #2d2d2d;
    --text-secondary: #686868;
    --text-tertiary: #8e8e8e;
    --accent: #cc785c;
    --accent-hover: #b76a4f;
    --border: #d4d4d4;
    --border-hover: #b8b8b8;
    --success: #2d9f6e;
    --warning: #d97706;
    --shadow: rgba(0, 0, 0, 0.08);
    
    /* Claude.ai Typography */
    --font-display: ui-serif, "Charter", Georgia, Cambria, "Times New Roman", Times, serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

body.dark-mode {
    /* Claude.ai Dark Mode Colors */
    --bg-primary: #1f1f1f;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #3a3a3a;
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --text-tertiary: #8e8e8e;
    --accent: #d4886d;
    --accent-hover: #e09980;
    --border: #404040;
    --border-hover: #565656;
    --success: #3fb584;
    --warning: #f59e0b;
    --shadow: rgba(0, 0, 0, 0.4);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 1.5rem;
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
}

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

header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.header-title h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.header-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dark-mode-toggle {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.dark-mode-toggle:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow);
}

.dark-mode-toggle:active {
    transform: translateY(0);
}

/* ============================================
   MAIN GRID LAYOUT
   ============================================ */

.main-grid {
    display: grid;
    grid-template-columns: minmax(320px, 400px) 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   CARD COMPONENTS
   ============================================ */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 16px var(--shadow);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

.card h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.section-divider {
    margin: 2rem 0;
    border: 0;
    border-top: 2px solid var(--border);
    position: relative;
}

.section-divider::after {
    content: attr(data-label);
    position: absolute;
    top: -0.6rem;
    left: 1rem;
    background: var(--bg-secondary);
    padding: 0 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

label .hint {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

input[type="number"], select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

input[type="number"]:hover, select:hover {
    border-color: var(--border-hover);
}

input[type="number"]:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.radio-group {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 2px solid var(--border);
}

.radio-option {
    flex: 1;
    position: relative;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-label {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.radio-option input[type="radio"]:checked + .radio-label {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.radio-label:hover {
    background: var(--bg-primary);
    border-color: var(--border);
}

.radio-option input[type="radio"]:checked + .radio-label:hover {
    background: var(--accent-hover);
    border-color: transparent;
}

.radio-sublabel {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    margin-top: 0.25rem;
    opacity: 0.8;
}

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

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

button {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

button:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--bg-tertiary);
}

/* ============================================
   PREVIEW SECTION
   ============================================ */

.preview-card {
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
}

.preview-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.preview-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
}

.preview-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.preview-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.preview-content {
    display: none;
}

.preview-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.preview-viewport-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.viewport-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.viewport-btn.active {
    background: var(--accent);
    color: white;
}

/* ============================================
   TYPOGRAPHY PREVIEW
   ============================================ */

.typography-preview-item {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.typography-preview-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateX(4px);
}

.preview-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.preview-text {
    color: var(--text-primary);
    font-weight: 500;
}

.preview-specs {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

/* ============================================
   SPACING PREVIEW
   ============================================ */

.spacing-preview-item {
    margin-bottom: 1rem;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--border);
    transition: all 0.2s ease;
}

.spacing-preview-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--shadow);
}

.spacing-inner {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

/* ============================================
   GAP PREVIEW
   ============================================ */

.gap-preview-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 10px;
    border: 2px solid var(--border);
    margin-bottom: 1rem;
}

.gap-preview-item {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

/* ============================================
   OUTPUT SECTION
   ============================================ */

.output-section {
    margin-top: 2rem;
}

.output-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

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

.output-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.output-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 700;
    margin: 0;
}

.copy-btn {
    padding: 0.5rem 1rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.copy-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.copy-btn.copied {
    background: var(--warning);
}

pre {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

code {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-muted {
    color: var(--text-secondary);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .header-top {
        flex-direction: column;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .radio-group {
        flex-direction: column;
    }

    .preview-card {
        position: static;
        max-height: none;
    }
}