:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-light: #f8fafc;
    --text-dim: #94a3b8;

    --bin-blue: #3b82f6;
    --bin-green: #22c55e;
    --bin-black: #cbd5e1;
    /* For dark mode contrast */
    --bin-garbage: #64748b;
    --bin-other: #f59e0b;
}

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

html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    /* Fixed Positioning Support */
    padding-top: 80px;
    padding-bottom: 80px;
    margin: 0;
}

/* ... existing blob styles ... */

/* App Header */
.app-header {
    width: 100%;
    padding: 1rem 1.5rem;
    /* Combine default padding with safe area inset */
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: fixed;
    /* Changed to fixed */
    top: 0;
    left: 0;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-logo {
    width: 40px;
    /* slightly smaller */
    height: 40px;
    filter: drop-shadow(0 0 5px rgba(34, 197, 94, 0.5));
}

.app-header h1 {
    font-size: 1.25rem;
    /* slightly smaller */
    font-weight: 700;
    margin: 0;
    background: linear-gradient(to right, #22c55e, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Main Content */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 0.5rem 1rem;
    /* Highly reduced vertical padding */
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin: auto;
    /* Vertically and horizontally center */
    /* Removed flex: 1 to stop stretching */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-text h2 {
    font-size: 1.5rem;
    /* smaller */
    margin-bottom: 0.1rem;
}

.hero-text p {
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    /* Reduced margin */
    font-size: 0.9rem;
}

/* Upload Area */
.upload-area {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    width: 100%;
    aspect-ratio: 4 / 3;
    /* Standard 4:3 Photo Ratio */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    /* Reduced margin */
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
}

.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-dim);
}

.placeholder-icon {
    font-size: 3rem;
}

#imagePreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.retake-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    pointer-events: none;
    /* Let clicks pass through to upload-area */
    z-index: 10;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.hidden {
    display: none !important;
}

/* Model Selector */
.model-selector-container {
    margin-bottom: 0.75rem;
    /* Reduced margin */
    width: 100%;
}

.model-select {
    width: 100%;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    font-size: 0.95rem;
    /* Slightly smaller font */
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5rem;
    transition: border-color 0.2s, background 0.2s;
}

.model-select:hover,
.model-select:focus {
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.15);
}

.model-select option {
    background-color: var(--bg-dark);
    color: var(--text-light);
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: 0.9rem;
    /* Slightly reduced padding */
    border-radius: 12px;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.05rem;
    /* Slightly smaller font */
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Result Card */
.result-card {
    margin-top: 1rem;
    /* Reduced margin */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem;
    /* Reduced padding */
    text-align: left;
    border-left: 5px solid transparent;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.bin-icon {
    font-size: 1.5rem;
}

.result-card h2 {
    font-size: 1.25rem;
    text-transform: capitalize;
}

.result-card p {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Bin Colors */
.bin-blue {
    border-color: var(--bin-blue);
}

.bin-blue h2 {
    color: var(--bin-blue);
}

.bin-green {
    border-color: var(--bin-green);
}

.bin-green h2 {
    color: var(--bin-green);
}

.bin-black {
    border-color: var(--bin-black);
}

.bin-black h2 {
    color: #fff;
}

.bin-garbage {
    border-color: var(--bin-garbage);
}

.bin-garbage h2 {
    color: var(--bin-garbage);
}

.bin-others {
    border-color: var(--bin-other);
}

.bin-others h2 {
    color: var(--bin-other);
}

.bin-error {
    border-color: #ef4444;
}

.bin-error h2 {
    color: #ef4444;
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid #ffffff;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* App Footer */
.app-footer {
    width: 100%;
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid var(--glass-border);
    /* Fixed Positioning */
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.github-link {
    color: var(--text-dim);
    display: flex;
    align-items: center;
    transition: color 0.2s, transform 0.2s;
}

.github-link:hover {
    color: var(--text-light);
    transform: scale(1.1);
}