:root {
    --primary-blue: #2196F3;
    --primary-green: #4CAF50;
    --primary-amber: #FFC107;
    --primary-red: #F44336;
    --primary-purple: #9C27B0;
    --background: #f5f5f5;
    --surface: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --nav-height: 70px;
}

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

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;
    padding-bottom: var(--nav-height);
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.language-toggle .lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.language-toggle .lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Main Content */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.app-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.app-section.active {
    display: block;
}

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

/* Camera Section */
.camera-container {
    background: var(--surface);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow);
    margin-bottom: 2rem;
}

.camera-view {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 1.5rem;
    border-radius: 15px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
}

#cameraVideo, #previewCanvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#previewCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.camera-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 3;
}

.style-indicator {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    display: inline-block;
    backdrop-filter: blur(10px);
}

.camera-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.control-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.control-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.control-btn.primary { background: var(--primary-blue); }
.control-btn.secondary { background: var(--text-secondary); }
.control-btn.capture { background: var(--primary-red); }
.control-btn.download { background: var(--primary-green); }

.processing-indicator {
    display: none;
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
}

.processing-indicator.active {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles Section */
.styles-header, .custom-header, .history-header, .gallery-header {
    text-align: center;
    margin-bottom: 2rem;
}

.styles-header h2, .custom-header h2, .history-header h2, .gallery-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
}

.styles-header p, .custom-header p, .history-header p, .gallery-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.styles-grid, .custom-styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.style-card {
    background: var(--surface);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.style-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.style-card.active {
    border: 3px solid var(--primary-blue);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.3);
}

.style-preview {
    width: 100%;
    height: 200px;
    background: linear-gradient(45deg, var(--border), var(--background));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    overflow: hidden;
}

.style-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.style-info {
    padding: 1.5rem;
}

.style-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.style-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

.artist-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Custom Styles Section */
.custom-upload {
    background: var(--surface);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 15px var(--shadow);
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 15px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--background);
}

.upload-area:hover {
    border-color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.1);
    transform: scale(1.02);
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
}

.style-form {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.style-form h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.style-form input, .style-form textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.style-form input:focus, .style-form textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.style-form textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary-red);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.style-card:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

/* History Section */
.history-content {
    display: grid;
    gap: 2rem;
}

.history-item {
    background: var(--surface);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 15px var(--shadow);
}

.history-item h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-blue);
}

.history-item p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.history-item .period {
    font-weight: 600;
    color: var(--primary-purple);
    font-size: 0.9rem;
}

/* Gallery Section */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.gallery-item {
    background: var(--surface);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
    position: relative;
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.gallery-item-info {
    padding: 1rem;
}

.gallery-item-info h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.gallery-item-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.gallery-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-actions {
    opacity: 1;
}

.gallery-action-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.gallery-action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.empty-gallery {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-gallery i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-gallery h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* FAQ Section */
.faq-section {
    background: var(--surface);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 15px var(--shadow);
    margin: 2rem 0;
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-blue);
    font-size: 2rem;
}

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

.faq-item {
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.5rem 0;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.faq-question:hover {
    color: var(--primary-blue);
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--primary-blue);
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 0 1.5rem 0;
    color: var(--text-secondary);
    line-height: 1.6;
    animation: fadeInDown 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

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

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--nav-height);
    z-index: 1000;
    box-shadow: 0 -2px 10px var(--shadow);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    min-width: 60px;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-item.active {
    color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.1);
}

.nav-item:hover:not(.active) {
    color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.05);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .camera-container, .custom-upload, .faq-section {
        padding: 1rem;
    }
    
    .camera-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .styles-grid, .custom-styles-grid, .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .app-header h1 {
        font-size: 1.2rem;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
    
    .nav-item i {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .styles-grid, .custom-styles-grid, .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .camera-view {
        aspect-ratio: 3/4;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .faq-question {
        font-size: 1rem;
        padding: 1rem 0;
    }
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Focus styles for keyboard navigation */
.control-btn:focus,
.nav-item:focus,
.faq-question:focus,
.style-card:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}
