/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Section Styles */
section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Color Input Section */
.color-input-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.color-picker-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.color-picker-container label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.color-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

input[type="color"] {
    width: 60px;
    height: 44px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

.hex-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: monospace;
    text-transform: uppercase;
    transition: border-color 0.2s;
}

.hex-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.color-format-inputs {
    margin-top: 0.5rem;
}

.rgb-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rgb-inputs label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0;
    min-width: 35px;
}

.rgb-input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-align: center;
}

.rgb-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.swap-colors-btn {
    background: var(--surface);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}

.swap-colors-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.swap-colors-btn svg {
    color: var(--text-secondary);
}

/* Contrast Ratio Section */
.contrast-ratio-section {
    text-align: center;
}

.ratio-display {
    margin-bottom: 1.5rem;
}

.ratio-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.ratio-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.wcag-compliance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.compliance-item {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: left;
    border-left: 4px solid var(--border-color);
    transition: border-color 0.3s;
}

.compliance-item.pass {
    border-left-color: var(--success-color);
}

.compliance-item.fail {
    border-left-color: var(--error-color);
}

.compliance-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.compliance-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.compliance-item.pass .compliance-status {
    background: #dcfce7;
    color: #166534;
}

.compliance-item.fail .compliance-status {
    background: #fee2e2;
    color: #991b1b;
}

.compliance-requirement {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Color Adjustment Section */
.adjustment-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.adjustment-group {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
}

.adjustment-group h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.slider-group {
    margin-bottom: 1rem;
}

.slider-group:last-child {
    margin-bottom: 0;
}

.slider-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.slider-group input[type="range"] {
    width: calc(100% - 50px);
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    vertical-align: middle;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    display: inline-block;
    width: 45px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.auto-adjust-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

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

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.btn-secondary:hover {
    background: #475569;
    border-color: #475569;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.suggested-colors {
    display: none;
}

.suggested-colors.visible {
    display: block;
}

.suggested-colors h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.suggestion-item {
    background: var(--background);
    border-radius: var(--radius);
    padding: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.suggestion-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.suggestion-preview {
    height: 60px;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.suggestion-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.suggestion-ratio {
    font-weight: 600;
    color: var(--text-primary);
}

/* Preview Section */
.preview-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.preview-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.preview-tab:hover {
    background: var(--background);
}

.preview-tab.active {
    background: var(--primary-color);
    color: white;
}

.preview-container {
    min-height: 300px;
}

.preview-content {
    display: none;
}

.preview-content.active {
    display: block;
}

.preview-box {
    padding: 2rem;
    border-radius: var(--radius);
    min-height: 200px;
}

.preview-box h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.preview-box .large-text {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.preview-box .normal-text {
    font-size: 1rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.preview-box .small-text {
    font-size: 0.75rem;
    margin-bottom: 1rem;
}

.preview-box .preview-link {
    text-decoration: underline;
}

/* UI Preview */
#ui-preview-box {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ui-component {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.ui-button {
    padding: 0.75rem 1.5rem;
    border: 2px solid currentColor;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ui-button.outlined {
    background: transparent !important;
}

.ui-input {
    padding: 0.75rem 1rem;
    border: 2px solid currentColor;
    border-radius: var(--radius);
    font-size: 0.95rem;
    min-width: 200px;
}

.ui-card {
    padding: 1.5rem;
    border: 1px solid currentColor;
    border-radius: var(--radius);
    max-width: 300px;
}

.ui-card h4 {
    margin-bottom: 0.5rem;
}

.ui-badge, .ui-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ui-tag {
    border: 1px solid currentColor;
    background: transparent !important;
}

/* Website Mock Preview */
.website-mock {
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 350px;
}

.mock-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.mock-logo {
    font-weight: 700;
    font-size: 1.25rem;
}

.mock-nav {
    display: flex;
    gap: 1.5rem;
}

.mock-nav a {
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.mock-nav a:hover {
    opacity: 1;
}

.mock-hero {
    padding: 3rem 1.5rem;
    text-align: center;
}

.mock-hero h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.mock-hero p {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.mock-cta {
    padding: 0.75rem 2rem;
    border: 2px solid currentColor;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.mock-content {
    padding: 2rem 1.5rem;
}

.mock-section h3 {
    margin-bottom: 0.5rem;
}

/* Color Info Section */
.color-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.color-info-card {
    background: var(--background);
    padding: 1.25rem;
    border-radius: var(--radius);
}

.color-info-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.color-swatch {
    height: 60px;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.color-values p {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-family: monospace;
}

.color-values p:last-child {
    margin-bottom: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .color-input-group {
        flex-direction: column;
    }

    .color-picker-container {
        min-width: 100%;
    }

    .swap-colors-btn {
        transform: rotate(90deg);
    }

    .ratio-value {
        font-size: 2.5rem;
    }

    .wcag-compliance {
        grid-template-columns: 1fr;
    }

    .adjustment-controls {
        grid-template-columns: 1fr;
    }

    .auto-adjust-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .preview-tabs {
        flex-wrap: wrap;
    }

    .preview-box {
        padding: 1rem;
    }

    .mock-header {
        flex-direction: column;
        gap: 1rem;
    }

    .mock-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .mock-hero {
        padding: 2rem 1rem;
    }

    .mock-hero h2 {
        font-size: 1.5rem;
    }

    .color-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .rgb-inputs {
        flex-wrap: wrap;
    }

    .rgb-input {
        width: 50px;
    }

    .suggestions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

section {
    animation: fadeIn 0.3s ease-out;
}

/* Print Styles */
@media print {
    .color-adjustment-section,
    .preview-section {
        display: none;
    }

    footer {
        position: fixed;
        bottom: 0;
        width: 100%;
    }
}
