/* ============================================
   CropSort Analyse - Main Stylesheet
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
    --primary-blue: #4A90E2;
    --primary-green: #2ECC71;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-gradient: linear-gradient(135deg,
            rgba(200, 255, 255, 0.8) 0%,
            rgba(230, 200, 255, 0.6) 25%,
            rgba(255, 255, 255, 0.9) 50%,
            rgba(255, 220, 180, 0.6) 75%,
            rgba(200, 255, 200, 0.5) 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #7a7a9a;
    --border-color: #e8e8f0;
    --btn-primary: #7c8ce0;
    --btn-hover: #6b7cd0;
    --success-green: #27ae60;
    --white: #ffffff;
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg,
            rgba(30, 40, 60, 1) 0%,
            rgba(40, 30, 60, 1) 25%,
            rgba(25, 25, 35, 1) 50%,
            rgba(50, 40, 40, 1) 75%,
            rgba(30, 45, 35, 1) 100%);
    --card-bg: rgba(40, 40, 55, 0.95);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --text-primary: #e8e8f0;
    --text-secondary: #b8b8d0;
    --text-muted: #8888a8;
    --border-color: #3a3a50;
    --btn-primary: #8a9cef;
    --btn-hover: #7a8cdf;
}

/* Base Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

/* Links */
a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

[data-theme="dark"] .header {
    background: rgba(30, 30, 45, 0.9);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon {
    width: 100%;
    height: 100%;
}

.brand-info h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Navigation */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(124, 140, 224, 0.1);
}

.nav-link.active {
    background: var(--btn-primary);
    color: var(--white);
}

.nav-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.nav-item:hover .nav-link svg {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 100;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .dropdown-menu {
    background: #2a2a3d;
    border-color: #3a3a50;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(124, 140, 224, 0.1);
    color: var(--btn-primary);
}

/* Disabled/Coming Soon Items */
.dropdown-item.disabled,
.tool-link.disabled,
.quick-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.dropdown-item.disabled:hover,
.tool-link.disabled:hover {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.coming-soon {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-left: 0.5rem;
}

/* Home Button */
.nav-link.home-link {
    background: transparent;
}

.nav-link.home-link:hover {
    background: rgba(124, 140, 224, 0.1);
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: rgba(124, 140, 224, 0.1);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    color: var(--text-primary);
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Tool Card */
.tool-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

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

.tool-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(124, 140, 224, 0.15) 0%, rgba(124, 140, 224, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-icon svg {
    width: 24px;
    height: 24px;
    color: var(--btn-primary);
}

.tool-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tool-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    padding-left: 0;
}

.tool-detail {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Tool Links */
.tool-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tool-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.tool-link:hover {
    border-color: var(--btn-primary);
    background: rgba(124, 140, 224, 0.05);
}

.tool-link svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: var(--transition);
}

.tool-link:hover svg {
    color: var(--btn-primary);
    transform: translateX(5px);
}

/* ============================================
   TOOL PAGE STYLES
   ============================================ */

.page-content {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.page-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-description {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Form Styles */
.upload-form {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.form-label .required {
    color: #e74c3c;
    margin-left: 0.25rem;
}

.form-label .optional {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 0.5rem;
    font-size: 0.85rem;
}

.file-input-wrapper {
    position: relative;
}

.file-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--white);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

[data-theme="dark"] .file-input {
    background: rgba(60, 60, 80, 0.5);
}

.file-input:hover {
    border-color: var(--btn-primary);
}

.file-input::file-selector-button {
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    border: none;
    border-radius: 6px;
    background: var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.file-input::file-selector-button:hover {
    background: var(--btn-primary);
    color: var(--white);
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    background: var(--btn-primary);
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.generate-btn:hover {
    background: var(--btn-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(124, 140, 224, 0.4);
}

.generate-btn svg {
    width: 20px;
    height: 20px;
}

/* Quick Access */
.quick-access {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
}

.quick-access-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.quick-access-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.quick-link {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.quick-link:hover {
    border-color: var(--btn-primary);
    color: var(--btn-primary);
    background: rgba(124, 140, 224, 0.05);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

.footer-heart {
    color: #e74c3c;
}

.footer-link {
    color: var(--btn-primary);
    font-weight: 500;
}

.footer-link:hover {
    text-decoration: underline;
}

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

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

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .page-card {
        padding: 1.5rem;
    }

    .main-content,
    .page-content {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .logo-section {
        gap: 0.5rem;
    }

    .logo {
        width: 40px;
        height: 40px;
    }

    .brand-info h1 {
        font-size: 1rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }
}

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

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

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

.tool-card {
    animation: fadeIn 0.5s ease forwards;
}

.tool-card:nth-child(1) {
    animation-delay: 0.1s;
}

.tool-card:nth-child(2) {
    animation-delay: 0.2s;
}

.page-card {
    animation: fadeIn 0.4s ease forwards;
}

/* Hover Glow Effect */
.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(124, 140, 224, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tool-card {
    position: relative;
    overflow: hidden;
}

.tool-card:hover::before {
    opacity: 1;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
}

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