/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2ecc71;
    --secondary-color: #27ae60;
    --accent-color: #3498db;
    --danger-color: #e74c3c;
    --dark-bg: #1a1a2e;
    --light-bg: #16213e;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-green: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.leaf {
    position: absolute;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    opacity: 0.1;
    border-radius: 0 100% 0 100%;
    animation: float 15s infinite ease-in-out;
}

.leaf1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 20s;
}

.leaf2 {
    top: 60%;
    left: 80%;
    animation-delay: 5s;
    animation-duration: 25s;
}

.leaf3 {
    top: 40%;
    left: 20%;
    animation-delay: 10s;
    animation-duration: 18s;
}

.leaf4 {
    top: 80%;
    left: 60%;
    animation-delay: 15s;
    animation-duration: 22s;
}

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

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    animation: fadeInDown 1s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 3rem;
    animation: rotate 3s infinite ease-in-out;
}

@keyframes rotate {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(15deg);
    }
}

.header h1 {
    font-size: clamp(2rem, 8vw, 3.5rem);
    background: var(--gradient-green);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: 2px;
    word-break: keep-all;
}

.tagline {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    color: var(--text-secondary);
    margin-top: 10px;
}

/* Main Content */
.main-content {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

/* Upload Section */
.upload-section {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 1s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 800px;
    margin: 0 auto;
}

.upload-container {
    width: 100%;
}

.upload-area {
    text-align: center;
    padding: 60px 40px;
    border: 3px dashed rgba(46, 204, 113, 0.5);
    border-radius: 20px;
    background: rgba(46, 204, 113, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(46, 204, 113, 0.1);
    transform: translateY(-5px);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(46, 204, 113, 0.2);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.upload-area h2 {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    margin-bottom: 10px;
    color: var(--primary-color);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
}

.preview-container {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

#previewImage {
    max-width: 100%;
    max-height: 500px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

.preview-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

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

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

.btn-icon {
    font-size: 1.3rem;
    position: relative;
    z-index: 1;
}

.btn span:not(.btn-icon) {
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: var(--gradient-green);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

.btn-success {
    background: var(--gradient-3);
    color: white;
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.btn-accent {
    background: var(--gradient-1);
    color: white;
}

.btn-accent:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
}



/* Results Section */
.results-section {
    animation: fadeInUp 0.8s ease;
}

.results-title {
    text-align: center;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 30px;
    background: var(--gradient-green);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.results-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.captured-image-container {
    width: 100%;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.5s ease;
}

.captured-image-container img {
    width: 100%;
    height: auto;
    display: block;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.results-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.plant-name, .confidence-score {
    animation: fadeIn 0.8s ease;
}

.label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.plant-name h3 {
    font-size: clamp(1.3rem, 4vw, 2rem);
    color: var(--primary-color);
    margin: 0;
    word-break: break-word;
}

.confidence-bar {
    position: relative;
    width: 100%;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.confidence-fill {
    height: 100%;
    background: var(--gradient-green);
    border-radius: 20px;
    transition: width 1s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15px;
    position: relative;
    overflow: hidden;
}

.confidence-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.confidence-text {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    margin-top: 20px;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Error Message */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 2px solid var(--danger-color);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    text-align: center;
    z-index: 1001;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.error-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.error-message p {
    margin: 15px 0;
    font-size: 1.1rem;
}

/* Footer */
.footer {
    margin-top: 80px;
    padding: 40px 20px 20px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 30px;
    text-align: left;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.footer-section h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.footer-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .logo {
        flex-direction: column;
        gap: 10px;
    }

    .logo-icon {
        font-size: 2.5rem;
    }

    .header {
        padding: 30px 15px;
    }

    .results-card {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 20px;
    }

    .preview-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 1rem;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-icon {
        font-size: 4rem;
    }

    .controls {
        flex-direction: column;
        width: 100%;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }

    .footer-section {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 20px 10px;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .upload-section {
        padding: 20px 15px;
    }

    .upload-area {
        padding: 30px 15px;
    }

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

    .results-card {
        padding: 15px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

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

    .confidence-bar {
        height: 35px;
    }

    .confidence-text {
        font-size: 1rem;
    }

    .footer {
        margin-top: 50px;
        padding: 30px 15px 15px;
    }

    .footer-section h3 {
        font-size: 1.3rem;
    }

    .footer-section h4 {
        font-size: 1rem;
    }

    .footer-section p {
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .upload-area h2 {
        font-size: 1.2rem;
    }

    .upload-area p {
        font-size: 0.85rem;
    }

    .label {
        font-size: 0.8rem;
    }
}
