:root {
    --bg-color: #f8f9fa;
    --bg-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%239C92AC' fill-opacity='0.1' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");
    --container-bg: #ffffff;
    --text-color: #333;
    --input-bg: #fdfdfd;
    --input-border: #e0e0e0;
    --button-bg: #ff7675;
    --button-hover: #fab1a0;
    --shadow-color: rgba(0,0,0,0.1);
    --progress-bg: #eee;
    --progress-fill: #ff7675;
}

[data-theme='dark'] {
    --bg-color: #1a1a1a;
    --bg-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.05' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E");
    --container-bg: #2d2d2d;
    --text-color: #f1f1f1;
    --input-bg: #3d3d3d;
    --input-border: #444;
    --button-bg: #d63031;
    --button-hover: #ff7675;
    --shadow-color: rgba(0,0,0,0.5);
    --progress-bg: #444;
    --progress-fill: #ee5253;
}

body {
    font-family: 'Jua', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 60px 20px;
    background-color: var(--bg-color);
    background-image: var(--bg-image);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--container-bg);
    border: 2px solid var(--button-bg);
    color: var(--button-bg);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Jua', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.theme-toggle:hover {
    background: var(--button-bg);
    color: white;
}

/* Animal Test Container */
.test-container {
    background-color: var(--container-bg);
    padding: 2.5rem;
    border-radius: 30px;
    box-shadow: 0 15px 40px var(--shadow-color);
    width: 100%;
    max-width: 500px;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 40px;
    box-sizing: border-box;
}

h1 { color: var(--text-color); margin-bottom: 0.5rem; font-size: 2.2rem; }
.subtitle { color: #888; margin-bottom: 2rem; }

/* Tabs */
.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    padding: 10px 20px;
    border: 2px solid var(--button-bg);
    background: transparent;
    color: var(--button-bg);
    border-radius: 15px;
    cursor: pointer;
    font-family: 'Jua', sans-serif;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--button-bg);
    color: white;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--button-bg);
    border-radius: 20px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--input-bg);
    position: relative;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 15px;
    object-fit: cover;
}

/* Webcam Area */
.webcam-container {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    min-height: 200px;
    align-items: center;
}

.webcam-container canvas {
    max-width: 100%;
    height: auto !important;
}

.webcam-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--button-bg);
    color: white;
    border: none;
    border-radius: 15px;
    font-family: 'Jua', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
}

/* Loading Spinner */
.loading { padding: 2rem; }
.spinner {
    border: 4px solid var(--progress-bg);
    border-top: 4px solid var(--button-bg);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Result Area */
.result-area { margin-top: 2rem; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

#result-title { color: var(--text-color); margin-bottom: 1.5rem; }

.bar-container {
    margin-bottom: 15px;
    text-align: left;
}

.label-title {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.bar-bg {
    background: var(--progress-bg);
    border-radius: 10px;
    height: 20px;
    width: 100%;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--progress-fill);
    transition: width 0.5s ease-out;
}

.retry-btn {
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: var(--button-bg);
    color: white;
    border: none;
    border-radius: 15px;
    font-family: 'Jua', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    width: 100%;
}

/* Contact Form Styling */
.contact-container {
    background-color: var(--container-bg);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
    width: 100%;
    max-width: 500px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.contact-container h2 { color: var(--text-color); text-align: center; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 0.5rem; color: var(--text-color); }
.form-group input, .form-group textarea {
    width: 100%; padding: 0.8rem; border: 1px solid var(--input-border);
    border-radius: 10px; background-color: var(--input-bg); color: var(--text-color);
    font-family: 'Jua', sans-serif; box-sizing: border-box;
}
.submit-btn {
    width: 100%; padding: 1rem; background-color: var(--button-bg); color: white;
    border: none; border-radius: 12px; font-family: 'Jua', sans-serif;
    font-size: 1.1rem; cursor: pointer;
}
