:root {
    --bg-color: #fff9f0;
    --container-bg: #ffffff;
    --text-color: #5a4632;
    --shadow: rgba(141, 110, 99, 0.15);
    --input-bg: #fff;
    --input-border: #e0d0c0;
    --accent-color: #ff9800;
    --secondary-color: #795548;
    --dog-color: #ffa726;
    --cat-color: #4db6ac;
}

body.dark-mode {
    --bg-color: #1a1510;
    --container-bg: #2d241c;
    --text-color: #e6ded6;
    --shadow: rgba(0, 0, 0, 0.4);
    --input-bg: #3e3228;
    --input-border: #4d3e32;
    --accent-color: #fb8c00;
    --secondary-color: #a1887f;
}

body {
    font-family: 'Jua', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
    padding: 20px;
}

.container {
    text-align: center;
    background-color: var(--container-bg);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 10px 30px var(--shadow);
    position: relative;
    transition: background-color 0.3s, box-shadow 0.3s;
    width: 95%;
    max-width: 600px;
}

h1 {
    margin-bottom: 5px;
    font-size: 2.5rem;
    color: var(--accent-color);
}

.subtitle {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
}

.subtitle-en {
    margin: 0 0 30px 0;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Buttons */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.main-btn {
    padding: 18px 30px;
    font-size: 1.2rem;
    cursor: pointer;
    border: none;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50px;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.main-btn:hover {
    background-color: #f57c00;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.secondary-btn {
    padding: 12px 25px;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid var(--secondary-color);
    background: transparent;
    color: var(--secondary-color);
    border-radius: 50px;
    margin-top: 20px;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.2s;
}

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

.upload-label {
    display: inline-block;
    cursor: pointer;
}

/* Image Containers */
#image-container {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#webcam-container, #uploaded-image {
    width: 280px;
    height: 280px;
    border-radius: 20px;
    overflow: hidden;
    object-fit: cover;
    box-shadow: 0 5px 15px var(--shadow);
    border: 5px solid var(--input-border);
}

/* Predictions & Bars */
#label-container {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.prediction-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.label-text {
    font-size: 1.1rem;
    font-weight: bold;
}

.progress-container {
    width: 100%;
    height: 25px;
    background-color: var(--input-bg);
    border-radius: 12.5px;
    overflow: hidden;
    border: 1px solid var(--input-border);
}

.progress-bar {
    height: 100%;
    width: 0%;
    transition: width 0.5s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
}

.bar-dog { background-color: var(--dog-color); }
.bar-cat { background-color: var(--cat-color); }

/* Article Section */
.article-section {
    text-align: left;
    margin-top: 20px;
}

.article-section h3 {
    margin-top: 25px;
    color: var(--accent-color);
}

.article-section p {
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 1rem;
}

.article-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.article-item {
    background-color: var(--input-bg);
    padding: 15px;
    border-radius: 15px;
    border: 1px solid var(--input-border);
}

.article-item h4 {
    margin: 0 0 10px 0;
    color: var(--secondary-color);
}

.privacy-note {
    background-color: #fff3e0;
    padding: 15px;
    border-left: 5px solid var(--accent-color);
    border-radius: 5px;
    color: #5a4632;
}
body.dark-mode .privacy-note {
    background-color: #3e2723;
    color: #e6ded6;
}

/* UI Elements */
#theme-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 12px;
    cursor: pointer;
    border: 1px solid var(--text-color);
    background: transparent;
    color: var(--text-color);
    border-radius: 10px;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.3s;
}

#theme-toggle:hover {
    background-color: var(--text-color);
    color: var(--container-bg);
}

hr {
    margin: 40px 0 30px 0;
    border: 0;
    border-top: 2px dashed var(--input-border);
}

.contact-form h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.contact-form form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-form input, 
.contact-form textarea {
    padding: 15px;
    border: 2px solid var(--input-border);
    border-radius: 15px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
}

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

.contact-form button {
    padding: 15px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    font-family: inherit;
    transition: background-color 0.2s;
}

.contact-form button:hover {
    background-color: #5d4037;
}

/* Footer */
.footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--input-border);
    font-size: 0.8rem;
    opacity: 0.7;
}

.footer-nav a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 5px;
}

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--input-border);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

@media (max-width: 480px) {
    .container {
        padding: 25px;
    }
    h1 {
        font-size: 1.8rem;
    }
    #webcam-container, #uploaded-image {
        width: 240px;
        height: 240px;
    }
    .article-grid {
        grid-template-columns: 1fr;
    }
}
