:root {
    --bg-main: #f8fcf9;
    --primary: #27c872;
    --primary-dark: #1ea35b;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --card-bg: #ffffff;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    -webkit-tap-highlight-color: transparent;
}

/* Typography & General */
h1, h2, h3 { color: var(--text-dark); }
.hidden { display: none !important; }

/* App Bar */
.app-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: transparent;
    padding-top: 2rem;
}

.user-greeting h1 {
    font-size: 1.5rem;
    font-weight: 800;
}

.user-greeting p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

.profile-pic img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.app-container {
    padding: 0 1.5rem 6rem 1.5rem;
}

/* Dashboard */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    margin-top: 0.5rem;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.plant-count {
    background: #e6f7ed;
    color: var(--primary-dark);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.plants-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.plant-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.03);
    transition: transform 0.2s;
    position: relative;
}

.plant-card:active { transform: scale(0.96); }

.plant-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.plant-card-info {
    padding: 1rem;
}

.plant-card-info h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-plant-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--danger);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    backdrop-filter: blur(4px);
    transition: transform 0.2s;
    z-index: 10;
}

.delete-plant-btn:active {
    transform: scale(0.85);
}

.water-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: #3b82f6;
    background: #eff6ff;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* FAB Scanner */
.fab-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.fab {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 10px 25px rgba(39, 200, 114, 0.4);
    cursor: pointer;
    transition: all 0.3s;
}

.fab:active { transform: scale(0.9); }

/* Loading Scanner Animation */
.align-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 70vh;
    text-align: center;
}

.scan-animation {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.scan-animation img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.8);
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 4px;
    background: #00ff00;
    box-shadow: 0 0 15px #00ff00, 0 0 30px #00ff00;
    animation: scan 2s linear infinite;
    z-index: 2;
}

@keyframes scan {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.loading-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.5rem; }
.loading-subtitle { color: var(--text-light); }

/* Result View */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.icon-btn {
    background: var(--card-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    font-size: 1.1rem;
    color: var(--text-dark);
}

.result-hero {
    position: relative;
    margin-top: 1rem;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.result-hero img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}

.health-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    backdrop-filter: blur(8px);
}

.health-badge.healthy { background: rgba(16, 185, 129, 0.9); color: white; }
.health-badge.sick { background: rgba(239, 68, 68, 0.9); color: white; }
.health-badge.warning { background: rgba(245, 158, 11, 0.9); color: white; }

.result-content {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 1.5rem;
    margin-top: -30px;
    position: relative;
    z-index: 10;
    box-shadow: 0 -10px 20px rgba(0,0,0,0.03);
}

.result-content h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.metrics-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-box {
    flex: 1;
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.water-icon { color: #3b82f6; font-size: 1.5rem; margin-bottom: 0.5rem; }
.metric-val { font-size: 1.2rem; font-weight: 800; }
.metric-label { font-size: 0.75rem; color: var(--text-light); text-transform: uppercase; font-weight: 600;}

.diagnosis-box, .treatment-box {
    margin-bottom: 1.5rem;
}

.diagnosis-box h3, .treatment-box h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.diagnosis-box h3 { color: var(--danger); }
.treatment-box h3 { color: var(--success); }

p#rDiagnosis, p#rTreatment {
    color: var(--text-light);
    line-height: 1.5;
    font-size: 0.95rem;
}

.btn-glow {
    width: 100%;
    padding: 1.2rem;
    border: none;
    border-radius: 16px;
    background: var(--primary);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    box-shadow: 0 10px 20px rgba(39, 200, 114, 0.3);
}

/* Animations */
.fade-in { animation: fadeIn 0.4s ease-in; }
.slide-up { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }

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

/* Bottom Sheet */
.bottom-sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s;
}

.bottom-sheet-content {
    background: var(--card-bg);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 1.5rem;
    padding-bottom: 3rem;
    transform: translateY(100%);
    animation: slideUpSheet 0.3s forwards ease-out;
}

@keyframes slideUpSheet {
    to { transform: translateY(0); }
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sheet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.sheet-btn {
    background: #f8fcf9;
    border: 2px solid #edf2f7;
    border-radius: 16px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sheet-btn:active {
    transform: scale(0.95);
    border-color: var(--primary);
}

.sheet-btn span {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: white;
}

.bg-green { background: var(--primary); }
.bg-blue { background: #3b82f6; }

/* Auth UI */
.auth-banner-btn {
    background: rgba(39, 200, 114, 0.1);
    color: var(--primary-dark);
    border: 1px solid rgba(39, 200, 114, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
}

.auth-banner-btn:active { background: rgba(39, 200, 114, 0.2); }

.auth-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #edf2f7;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.auth-input:focus { border-color: var(--primary); }

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-light);
}

.auth-switch span {
    color: var(--primary);
    font-weight: 800;
    cursor: pointer;
}

.auth-error {
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1rem;
    background: #fee2e2;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 600;
}
