/* ===============================
   VARIABLES Y ESTILOS BASE
   =============================== */

:root {
    --primary-color: #10B981;
    --primary-light: #34D399;
    --primary-dark: #059669;
    --secondary-color: #8B5CF6;
    --accent-color: #F59E0B;
    --success-color: #14B8A6;
    --danger-color: #EF4444;
    --warning-color: #F97316;
    --neutral-light: #F8FAFC;
    --neutral-medium: #E2E8F0;
    --neutral-dark: #1E293B;
    --card-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    --card-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.2);
    --border-radius: 20px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme colors */
[data-theme="dark"] {
    --primary-color: #10B981;
    --primary-light: #34D399;
    --primary-dark: #059669;
    --secondary-color: #A78BFA;
    --accent-color: #FBBF24;
    --success-color: #14B8A6;
    --danger-color: #F87171;
    --warning-color: #FB923C;
    --neutral-light: #1E293B;
    --neutral-medium: #334155;
    --neutral-dark: #F1F5F9;
    --card-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    --card-shadow-hover: 0 20px 60px rgba(0, 0, 0, 0.7);
}

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

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--neutral-dark);
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F766E 100%),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><defs><linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%2310B981;stop-opacity:0.1"/><stop offset="100%" style="stop-color:%238B5CF6;stop-opacity:0.05"/></linearGradient></defs><rect fill="url(%23grad1)" width="1200" height="600"/></svg>');
    background-attachment: fixed;
    background-size: cover;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 50%, #1E293B 100%),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><defs><linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%2310B981;stop-opacity:0.08"/><stop offset="100%" style="stop-color:%238B5CF6;stop-opacity:0.03"/></linearGradient></defs><rect fill="url(%23grad1)" width="1200" height="600"/></svg>');
    background-attachment: fixed;
}

/* ===============================
   HEADER
   =============================== */

.header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 50%, var(--secondary-color) 100%);
    padding: 3rem 1rem;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.25);
    position: relative;
    overflow: hidden;
    border-bottom: 2px solid rgba(52, 211, 153, 0.3);
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: floatAnimation 20s ease-in-out infinite;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: floatAnimation 25s ease-in-out infinite reverse;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    text-align: left;
    flex-wrap: wrap;
    width: 100%;
}

.plant-logo-animated {
    flex-shrink: 0;
}

.title-section {
    color: white;
    flex: 1;
    min-width: 200px;
}

.title-section h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.95;
    letter-spacing: 0.3px;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1) rotate(20deg);
}

/* ===============================
   MAIN CONTAINER
   =============================== */

.main-container {
    flex: 1;
    padding: 3rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ===============================
   UPLOAD SECTION
   =============================== */

.upload-section {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.modern-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 3rem;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 700px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid rgba(52, 211, 153, 0.2);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .modern-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
}

.modern-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-8px);
    border-color: rgba(52, 211, 153, 0.4);
}

.upload-icon {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.modern-card h2 {
    font-size: 2rem;
    color: var(--neutral-dark);
    margin-bottom: 0.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upload-subtitle {
    color: #64748B;
    font-size: 1rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
    font-weight: 500;
}

/* ===============================
   BUTTON STYLES
   =============================== */

.button-group {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #FFFFFF 0%, #F0F9FF 100%);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-weight: 700;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    transform: translateY(-3px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--success-color) 100%);
    color: white;
    border: 2px solid var(--primary-light);
    font-weight: 700;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-dark);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    transform: translateY(-3px);
}

.btn-success {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--success-color) 100%);
    color: white;
    border: none;
    width: 100%;
    margin-top: 1.5rem;
    font-size: 1.15rem;
    padding: 1.1rem;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.5);
    transform: translateY(-3px);
}

.btn-icon {
    font-size: 1.3rem;
}

/* ===============================
   PREVIEW SECTION
   =============================== */

.preview-section {
    display: none;
    justify-content: center;
    margin-bottom: 3rem;
    animation: slideInUp 0.6s ease-out;
}

.preview-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 750px;
    transition: var(--transition);
    border: 1px solid rgba(52, 211, 153, 0.2);
    overflow: hidden;
}

[data-theme="dark"] .preview-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.preview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
}

.preview-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-8px);
    border-color: rgba(52, 211, 153, 0.4);
}

.image-wrapper {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #f9f9f9;
    margin-bottom: 1.5rem;
}

.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(46, 125, 50, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-wrapper:hover .image-overlay {
    opacity: 1;
}

.loading-text {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
}

/* ===============================
   RESULT SECTION
   =============================== */

.result-section {
    display: none;
    justify-content: center;
    animation: slideInUp 0.6s ease-out;
    margin-bottom: 3rem;
}

.result-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 750px;
    transition: var(--transition);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

[data-theme="dark"] .result-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.result-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-8px);
}

.result-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.result-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.result-header h2 {
    font-size: 1.75rem;
    margin: 0;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.result-header-line {
    height: 4px;
    width: 60px;
    background: rgba(255, 255, 255, 0.9);
    margin-top: 0.75rem;
    border-radius: 2px;
    position: relative;
    z-index: 1;
}

.result-content {
    padding: 2.5rem;
}

.result-info-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-radius: 15px;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.plant-info {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.info-value {
    font-size: 1.25rem;
    color: var(--neutral-dark);
    font-weight: 600;
}

.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.3), transparent);
    margin: 2rem 0;
    border-radius: 1px;
}

/* ===============================
   HEALTH SECTION
   =============================== */

.health-section {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(20, 184, 166, 0.08) 100%);
    padding: 2rem;
    border-radius: 15px;
    border-left: 5px solid var(--primary-light);
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.08);
}

.health-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.health-icon {
    font-size: 1.75rem;
}

.health-title {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.health-text {
    color: #475569;
    line-height: 1.8;
    font-size: 1rem;
}

/* ===============================
   RECOMMENDATIONS SECTION
   =============================== */

.recommendations-section {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(245, 158, 11, 0.08) 100%);
    padding: 2rem;
    border-radius: 15px;
    border-left: 5px solid var(--warning-color);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.08);
}

.recommendations-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.alert-icon {
    font-size: 1.75rem;
}

.rec-title {
    font-weight: 700;
    color: #D97706;
    font-size: 1.1rem;
}

.recommendations-list ul {
    list-style: none;
    padding: 0;
}

.recommendations-list li {
    padding: 0.85rem 0;
    padding-left: 2rem;
    position: relative;
    color: #475569;
    line-height: 1.8;
    font-size: 1rem;
}

.recommendations-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-light);
    font-weight: bold;
    font-size: 1.3rem;
}

/* ===============================
   NOT FOUND SECTION
   =============================== */

.not-found-section {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(249, 115, 22, 0.08) 100%);
    padding: 2rem;
    border-radius: 15px;
    border-left: 5px solid var(--danger-color);
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    color: #DC2626;
    text-align: left;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.08);
}

.not-found-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

/* ===============================
   ERROR SECTION
   =============================== */

.error-section {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(249, 115, 22, 0.1) 100%);
    padding: 2rem;
    border-radius: 15px;
    border-left: 5px solid var(--danger-color);
    color: #DC2626;
    font-weight: 600;
    text-align: left;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.1);
}

/* ===============================
   ANIMATIONS
   =============================== */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatAnimation {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(20px);
    }
}

@keyframes grow {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes sway {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

@keyframes analyzing {
    0% { fill: #76E070; }
    50% { fill: #ffd700; }
    100% { fill: #76E070; }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.analyzing #flower-center {
    animation: analyzing 1.5s infinite;
}

.growing #plant {
    animation: grow 2s infinite;
}

.identified #plant {
    animation: sway 3s ease-in-out infinite;
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */

@media (max-width: 768px) {
    .header {
        padding: 2rem 1rem;
    }

    .title-section h1 {
        font-size: 2.2rem;
    }

    .logo-section {
        gap: 1rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .main-container {
        padding: 2rem 1rem;
    }

    .modern-card {
        padding: 2rem;
    }

    .modern-card h2 {
        font-size: 1.7rem;
    }

    .button-group {
        gap: 1rem;
    }

    .btn {
        padding: 0.85rem 1.5rem;
        font-size: 0.95rem;
    }

    .result-info-group {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .result-content {
        padding: 1.5rem;
    }

    .result-header {
        padding: 1.5rem;
    }

    .result-header h2 {
        font-size: 1.4rem;
    }

    .preview-card {
        padding: 1.5rem;
    }

    .health-section,
    .recommendations-section,
    .not-found-section {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .title-section h1 {
        font-size: 1.75rem;
    }

    .plant-logo-animated {
        width: 50px;
        height: 50px;
    }

    .logo-section {
        gap: 0.75rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .button-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .modern-card {
        padding: 1.5rem;
    }

    .modern-card h2 {
        font-size: 1.4rem;
    }

    .result-card {
        border-radius: 15px;
    }

    .result-header {
        padding: 1rem;
    }

    .result-header h2 {
        font-size: 1.1rem;
    }

    .result-content {
        padding: 1rem;
    }

    .plant-info {
        font-size: 0.9rem;
    }

    .health-section,
    .recommendations-section,
    .not-found-section {
        padding: 1rem;
    }

    .health-header,
    .recommendations-header {
        gap: 0.5rem;
    }

    .health-icon,
    .alert-icon,
    .not-found-icon {
        font-size: 1.4rem;
    }

    .health-title,
    .rec-title {
        font-size: 0.95rem;
    }

    .result-info-group {
        padding: 1rem;
    }
}

/* ===============================
   SCROLLBAR STYLING
   =============================== */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-light), var(--secondary-color));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
}

/* ===============================
   PRINT STYLES
   =============================== */

@media print {
    body {
        background: white;
    }

    .header {
        box-shadow: none;
        border-bottom: 1px solid #ddd;
    }

    .btn,
    .upload-section {
        display: none;
    }

    .result-section {
        display: flex;
    }
}