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

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2ecc71;
    --accent-color: #9b59b6;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

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

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

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

.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: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.tagline {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
}

/* Sections */
.section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section h2 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

/* Color Picker Section */
.color-picker-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.color-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-input-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-light);
}

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

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

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

input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: 'Consolas', 'Monaco', monospace;
    width: 100px;
    transition: var(--transition);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.color-preview {
    width: 100px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

/* Scheme Section */
.scheme-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.scheme-type-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.scheme-type-selector label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-light);
}

select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    min-width: 180px;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background: #27ae60;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-export {
    background: var(--text-color);
    color: white;
}

.btn-export:hover {
    background: #1a252f;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Generated Colors */
.generated-colors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.color-swatch {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.color-swatch:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.swatch-color {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swatch-info {
    padding: 0.75rem;
    text-align: center;
}

.swatch-hex {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.swatch-name {
    font-size: 0.8rem;
    color: var(--text-light);
}

.swatch-copy {
    font-size: 0.75rem;
    color: var(--primary-color);
    margin-top: 0.25rem;
}

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

.standard-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 1rem;
    border-left: 4px solid var(--primary-color);
}

.standard-card:nth-child(2) {
    border-left-color: var(--accent-color);
}

.standard-card:nth-child(3) {
    border-left-color: var(--secondary-color);
}

.standard-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.standard-card ul {
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-light);
}

.standard-card li {
    padding: 0.25rem 0;
    padding-left: 1rem;
    position: relative;
}

.standard-card li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* Contrast Section */
.contrast-checker {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contrast-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.contrast-preview {
    margin: 1rem 0;
}

.preview-box {
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
}

.preview-text-normal {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.preview-text-large {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Accessibility Results */
.accessibility-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.result-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.result-card h4 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.ratio-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
}

.apca-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.wcag-results p,
.apca-results p {
    font-size: 0.85rem;
    margin: 0.25rem 0;
}

.status {
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.status.pass {
    background: rgba(39, 174, 96, 0.15);
    color: var(--success-color);
}

.status.fail {
    background: rgba(231, 76, 60, 0.15);
    color: var(--error-color);
}

/* Export Section */
.export-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.export-output {
    background: #1e1e1e;
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    display: none;
}

.export-output.active {
    display: block;
}

#exportCode {
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Footer */
.footer {
    background: var(--text-color);
    color: white;
    padding: 1.5rem;
    text-align: center;
    margin-top: auto;
}

.footer p {
    font-size: 0.9rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.footer a:hover {
    color: #5dade2;
    text-decoration: underline;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--text-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--error-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

    .header h1 {
        font-size: 1.35rem;
    }

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

    .tagline {
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem;
    }

    .section {
        padding: 1rem;
    }

    .section h2 {
        font-size: 1.1rem;
    }

    .color-picker-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .scheme-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .scheme-type-selector {
        width: 100%;
    }

    select {
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .contrast-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .color-input-group {
        width: 100%;
    }

    .color-input-wrapper {
        width: 100%;
    }

    input[type="text"] {
        flex: 1;
    }

    .export-controls {
        flex-direction: column;
    }

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

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

    .accessibility-results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.2rem;
    }

    .generated-colors {
        grid-template-columns: 1fr;
    }

    .swatch-color {
        height: 60px;
    }

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

    .preview-box {
        padding: 1rem;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease;
}

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

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

/* Focus states for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}
