/* CSS Variables */
:root {
    --primary-color: #2c5530;
    --primary-light: #4a7c59;
    --primary-dark: #1a3d1f;
    --secondary-color: #8bc34a;
    --accent-color: #ff9800;
    --success-color: #4caf50;
    --warning-color: #ffc107;
    --error-color: #f44336;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --border-radius: 8px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-text {
    color: var(--text-secondary);
    margin-right: 1rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #7cb342;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Hero Section */
.hero-section {
    padding: 4rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-content > p {
    font-size: 1.25rem;
    margin-bottom: 3rem;
    opacity: 0.9;
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.feature p {
    opacity: 0.9;
}

/* Dashboard */
.dashboard-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

.dashboard-header h1 {
    color: var(--text-primary);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.project-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.project-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.project-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Project Details */
.project-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

.project-info {
    flex: 1;
}

.project-info h1 {
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.project-info p {
    color: var(--text-secondary);
}

.documents-section h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.document-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.document-card:hover {
    transform: translateY(-1px);
}

.document-card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.document-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.processing-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
}

.status-processing {
    background-color: #fff3cd;
    color: #856404;
}

.status-failed {
    background-color: #f8d7da;
    color: #721c24;
}

/* Analysis Section */
.analysis-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

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

.document-info {
    flex: 1;
}

.document-stats {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
}

.stat {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.analysis-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Plant Items */
.plant-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.items-summary {
    font-size: 1.125rem;
    color: var(--primary-color);
}

.plant-item {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.plant-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.plant-item h4 {
    color: var(--primary-color);
}

.plant-item-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.override-indicator {
    background-color: var(--warning-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* OCR Text */
.ocr-text-content {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.ocr-text {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Scale Calibration */
.scale-calibration-content {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.current-scale {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.current-scale h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.add-manual-scale h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Upload Progress */
.upload-progress {
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

#progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    display: none;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content {
    padding: 2rem;
}

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

.modal-header h2 {
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background-color: var(--background-color);
}

.modal-footer {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
}

.modal-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.modal-footer a:hover {
    text-decoration: underline;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--error-color);
}

.notification.warning {
    background-color: var(--warning-color);
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .nav-menu {
        gap: 0.5rem;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-content > p {
        font-size: 1rem;
    }
    
    .hero-features {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .project-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .analysis-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .document-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .plant-item-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .plant-item-meta {
        grid-template-columns: 1fr;
    }
    
    .modal {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
}
