:root {
    --primary: #4CAF50;
    --secondary: #8BC34A;
    --dark: #2E7D32;
    --light: #C8E6C9;
    --accent: #FF9800;
    --danger: #E53935;
    --safe: #66BB6A;
    --text-dark: #1A237E;
    --text-light: #666;
    --bg-light: #F5F5F5;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Roboto', Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--light) 0%, var(--secondary) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    padding: 1rem;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
header {
    text-align: center;
    padding: 3rem 2rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.logo {
    width: 160px;
    height: 160px;
    margin: 0 auto 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2), inset 0 0 30px rgba(255, 255, 255, 0.2);
    animation: float 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.logo svg {
    width: 110px;
    height: 110px;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.1));
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Upload Section */
.upload-section {
    padding: 2.5rem;
    border: 2px dashed var(--secondary);
    border-radius: 15px;
    margin: 2rem;
    transition: var(--transition);
    background: linear-gradient(135deg, rgba(139, 195, 74, 0.05), rgba(76, 175, 80, 0.05));
}

.upload-section:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(139, 195, 74, 0.1));
    transform: translateY(-2px);
}

.upload-content h3 {
    color: var(--dark);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    border: none;
    border-radius: 50px;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--dark));
    color: white;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: linear-gradient(135deg, #607D8B, #455A64);
    color: white;
    box-shadow: 0 4px 15px rgba(69, 90, 100, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.btn-analyze {
    width: calc(100% - 4rem);
    margin: 1rem 2rem;
    padding: 16px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--primary), var(--dark));
    color: white;
    box-shadow: var(--shadow);
}

.btn-analyze:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Image Preview */
.image-preview {
    display: none;
    text-align: center;
    padding: 1.5rem 0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    object-fit: cover;
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 3rem 2rem;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.spinner {
    border: 4px solid var(--bg-light);
    border-radius: 50%;
    border-top: 4px solid var(--primary);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-top: 1rem;
}

/* Results */
.results {
    display: none;
    padding: 2rem;
    animation: slideUp 0.4s ease-out;
}

.result-card {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05), rgba(139, 195, 74, 0.05));
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.result-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(46, 125, 50, 0.1);
}

.result-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.result-label {
    display: block;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.result-value {
    display: block;
    color: var(--text-dark);
}

.highlight {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
}

.scientific {
    display: block;
    font-style: italic;
    color: var(--text-light);
    margin-top: 0.3rem;
    font-size: 0.95rem;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--danger);
    color: white;
}

.status-badge.safe {
    background: var(--safe);
}

.recommendations-text {
    background: white;
    padding: 1.2rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    line-height: 1.8;
    color: var(--text-dark);
}

.recommendation-block {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08), rgba(139, 195, 74, 0.08));
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.recommendation-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.recommendation-desc {
    margin: 0.5rem 0 0 0;
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.6;
}

.recommendations-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    border-radius: 6px;
    overflow: hidden;
}

.recommendation-item {
    padding: 0.7rem 1rem;
    margin: 0.3rem 0;
    background: rgba(76, 175, 80, 0.05);
    border-left: 3px solid var(--secondary);
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.6;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.recommendation-item::before {
    content: '•';
    margin-right: 0.8rem;
    color: var(--primary);
    font-weight: bold;
    font-size: 1.2rem;
}

.recommendation-item:hover {
    background: rgba(76, 175, 80, 0.12);
    transform: translateX(4px);
    border-left-color: var(--primary);
}

.recommendation-text {
    margin: 1rem 0;
    padding: 0.8rem;
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.6;
    background: rgba(76, 175, 80, 0.03);
    border-radius: 4px;
}

.recommendations-list strong {
    color: var(--dark);
    font-weight: 700;
}

.recommendations-list em {
    color: var(--text-light);
    font-style: italic;
}

/* Camera Dialog */
.camera-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
}

.camera-video {
    max-width: 90%;
    max-height: 70%;
    border-radius: 15px;
    object-fit: cover;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.camera-buttons {
    display: flex;
    gap: 1rem;
}

.camera-buttons .btn {
    min-width: 150px;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 0.95rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        border-radius: 15px;
    }

    header {
        padding: 2rem 1rem 1.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .logo {
        width: 120px;
        height: 120px;
    }

    .logo svg {
        width: 80px;
        height: 80px;
    }

    .upload-section {
        padding: 1.5rem;
        margin: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .btn-analyze {
        width: calc(100% - 2rem);
        margin: 1rem 1rem;
    }

    .results {
        padding: 1.5rem;
    }

    .result-card {
        padding: 1.5rem;
    }

    .preview-image {
        max-height: 300px;
    }

    .camera-video {
        max-width: 100%;
        max-height: 60%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }

    header {
        padding: 1.5rem 1rem 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .logo {
        width: 100px;
        height: 100px;
    }

    .logo svg {
        width: 70px;
        height: 70px;
    }

    header p {
        font-size: 0.9rem;
    }

    .upload-section {
        padding: 1rem;
        margin: 1rem 0.5rem;
    }

    .upload-content h3 {
        font-size: 1.1rem;
    }

    .results {
        padding: 1rem;
    }

    .result-card {
        padding: 1rem;
    }

    .result-label {
        font-size: 1rem;
    }

    .highlight {
        font-size: 1.2rem;
    }

    footer {
        padding: 1.5rem 1rem;
        font-size: 0.85rem;
    }
}
