/* Base styles and reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --primary-dark: #2980b9;
    --secondary-color: #2ecc71;
    --secondary-dark: #27ae60;
    --text-color: #333;
    --text-light: #666;
    --background-color: #f5f5f5;
    --card-background: #fff;
    --border-color: #ddd;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Typography */
h1, h2, h3, h4 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

h1 {
    font-size: 2.2rem;
    text-align: center;
}

h2 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.3rem;
}

p {
    margin-bottom: 1rem;
}

/* Header and Footer */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* User Profile */
.user-profile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-background);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

#welcome-message {
    font-size: 1.2rem;
    font-weight: bold;
}

#stats-container {
    display: flex;
    gap: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Screens */
.screen {
    display: none;
    background-color: var(--card-background);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    min-height: 60vh;
}

.screen.active {
    display: block;
}

/* Home Screen Mode Selection */
.mode-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.mode-card {
    background-color: var(--background-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.mode-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.mode-title {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.mode-description {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Settings Panel */
.settings-panel {
    background-color: var(--background-color);
    padding: 1rem;
    border-radius: var(--radius);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

select, input[type="checkbox"] {
    padding: 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* Exercise Container */
.exercise-container {
    margin-bottom: 2rem;
}

/* Color Boxes */
.color-box {
    width: 100%;
    height: 100px;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.color-box.large {
    height: 150px;
}

.target-color-container, .user-color-container {
    margin-bottom: 1.5rem;
}

/* Color Sliders */
.color-sliders {
    margin-top: 1rem;
}

.slider-group {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
}

.slider-group label {
    width: 100px;
    font-weight: bold;
}

.slider-group input[type="range"] {
    flex-grow: 1;
    margin: 0 1rem;
}

/* Shade Sorting */
.shade-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: center;
}

.shade-swatch {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    cursor: grab;
    transition: var(--transition);
    border: 2px solid transparent;
    box-shadow: var(--shadow);
}

.shade-swatch:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.shade-swatch.dragging {
    cursor: grabbing;
    opacity: 0.8;
    transform: scale(1.1);
}

/* Ishihara Plate */
.ishihara-plate {
    width: 100%;
    max-width: 300px;
    height: 300px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.answer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 300px;
    margin: 0 auto;
}

.answer-container input {
    padding: 0.8rem;
    font-size: 1.2rem;
    text-align: center;
    width: 100px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
}

/* Color Naming */
.naming-options {
    margin-top: 1.5rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.color-option {
    padding: 0.8rem;
    background-color: var(--background-color);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.color-option:hover {
    background-color: var(--primary-color);
    color: white;
}

.color-option.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
}

/* Navigation Bar */
.navigation-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.nav-btn {
    background-color: var(--background-color);
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.nav-btn.warning:hover {
    background-color: var(--error-color);
}

/* Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-dark);
}

.secondary-btn {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background-color: var(--border-color);
}

/* Feedback Panels */
.feedback-panel {
    background-color: var(--background-color);
    padding: 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    text-align: center;
}

.feedback-panel.success {
    background-color: rgba(46, 204, 113, 0.2);
    border: 1px solid var(--success-color);
}

.feedback-panel.error {
    background-color: rgba(231, 76, 60, 0.2);
    border: 1px solid var(--error-color);
}

.hidden {
    display: none;
}

/* Progress Screen */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.progress-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.progress-card {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
}

.progress-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.progress-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-label {
    width: 120px;
}

.progress-bar-container {
    flex-grow: 1;
    height: 12px;
    background-color: var(--background-color);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 6px;
}

.progress-percent {
    width: 50px;
    text-align: right;
    font-weight: bold;
}

.recommendations-list {
    background-color: var(--background-color);
    padding: 1rem;
    border-radius: var(--radius);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
}

.close-modal {
    float: right;
    font-size: 1.5rem;
    cursor: pointer;
}

#modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

#modal-body {
    margin-bottom: 1.5rem;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .user-profile {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .mode-selection {
        grid-template-columns: 1fr;
    }
    
    .slider-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .slider-group label {
        width: auto;
        margin-bottom: 0.3rem;
    }
    
    .slider-group input[type="range"] {
        margin: 0.5rem 0;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .progress-item {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    .progress-label, .progress-percent {
        width: auto;
        text-align: center;
        margin-bottom: 0.3rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .screen {
        padding: 1rem;
    }
    
    .navigation-bar {
        flex-direction: column;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: center;
    }
}
