/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #8BC34A;
    --success-color: #2ecc71;
    --warning-color: #CDDC39;
    --yellow-zone: #CDDC39;
    --danger-color: #e74c3c;
    --dark-bg: #f5f7fa;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e8ecef;
    --hover-bg: #f8f9fa;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.85) 0%, rgba(102, 187, 106, 0.85) 50%, rgba(129, 199, 132, 0.8) 100%),
                url('https://images.unsplash.com/photo-1625246333195-78d9c38ad449?w=1920&q=80') center/cover no-repeat fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(76, 175, 80, 0.08);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    margin-right: 12px;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.nav-item .badge {
    margin-left: auto;
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin-top: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Main Content Styles */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 0;
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Search box - removed from UI
.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f5f7fa;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 250px;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box i {
    color: var(--text-secondary);
}
*/

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

/* Mobile Menu Toggle Button */
.btn-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.btn-menu-toggle:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

/* Dashboard Layout */
.dashboard {
    padding: 32px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(30px);
    min-height: calc(100vh - 96px);
    border-radius: 24px 0 0 0;
    position: relative;
}

.dashboard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
    border-radius: 24px 0 0 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    border-color: rgba(76, 175, 80, 0.4);
    background: rgba(255, 255, 255, 0.95);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card.primary .stat-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card.success .stat-icon {
    background: linear-gradient(135deg, #4CAF50 0%, #2ecc71 100%);
}

.stat-card.warning .stat-icon {
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
}

.stat-card.danger .stat-icon {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.stat-info h3 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}

/* Widget Styles */
.widget {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 0.3s ease;
}

.widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 100%);
    pointer-events: none;
}

.widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
}

.widget-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.widget-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.widget-select {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.widget-select:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.widget-body {
    padding: 24px;
    position: relative;
    z-index: 1;
}

/* Current Crops Widget */
.current-crops {
    grid-column: span 6;
}

.crops-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.crop-card {
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.crop-card.corn {
    background: rgba(205, 220, 57, 0.95);
    backdrop-filter: blur(10px);
    color: #2c3e50;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.crop-card.carrot {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.95) 0%, rgba(245, 124, 0, 0.95) 100%);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.crop-card.potato {
    background: linear-gradient(135deg, rgba(188, 170, 164, 0.95) 0%, rgba(161, 136, 127, 0.95) 100%);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.crop-card.add {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 2px dashed rgba(203, 213, 224, 0.6);
    color: var(--text-secondary);
}

.crop-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.crop-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.crop-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.crop-amount {
    font-size: 14px;
    opacity: 0.9;
}

/* Crop Progress Widget */
.crop-progress {
    grid-column: span 6;
}

.crop-progress-item {
    padding: 16px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.crop-progress-item:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.crop-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.crop-info-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.crop-info-inline i {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.crop-icon-corn {
    background: linear-gradient(135deg, #CDDC39 0%, #C0CA33 100%);
    color: #2c3e50;
}

.crop-icon-carrot {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
}

.crop-icon-potato {
    background: linear-gradient(135deg, #BCAAA4 0%, #A1887F 100%);
    color: white;
}

.crop-info-inline h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.crop-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-percent {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.crop-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.crop-progress-meta i {
    margin-right: 4px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.in-progress {
    background: rgba(33, 150, 243, 0.15);
    color: #2196F3;
}

.status-badge.almost-done {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

/* Recent Activities Widget */
.recent-activities {
    grid-column: span 6;
}

.link-view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.link-view-all:hover {
    text-decoration: underline;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.activity-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-icon.diary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.activity-icon.batch {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.activity-icon.cert {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.activity-icon.media {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.activity-info {
    flex: 1;
}

.activity-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Activities Chart Widget */
.activities-chart {
    grid-column: span 6;
}

.chart-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.chart-stat-item {
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.chart-stat-item .stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.chart-stat-item .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.chart-container {
    height: 250px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Harvest Yield Widget */
.harvest-yield {
    grid-column: span 6;
}

.yield-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.yield-stat-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.yield-stat-box i {
    font-size: 32px;
    color: var(--primary-color);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 12px;
}

.yield-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.yield-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Progress Bar - General */
.progress-bar {
    height: 8px;
    background: rgba(232, 236, 239, 0.8);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Certificates Status Widget */
.certificates-status {
    grid-column: span 6;
}

.btn-add-small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(76, 175, 80, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-small:hover {
    background: rgba(76, 175, 80, 1);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    transform: scale(1.05);
}

/* Button styles - General */
.btn-outline {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 1);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.btn-outline.warning {
    background: var(--yellow-zone);
    border-color: var(--yellow-zone);
    color: #2c3e50;
    font-weight: 600;
}

.widget-actions {
    display: flex;
    gap: 12px;
}

.cert-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.cert-item:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.cert-badge {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.cert-item.valid .cert-badge {
    background: linear-gradient(135deg, #4CAF50 0%, #2ecc71 100%);
}

.cert-item.expiring .cert-badge {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.cert-info {
    flex: 1;
}

.cert-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.cert-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.cert-status {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(46, 204, 113, 0.2);
    color: var(--success-color);
}

.cert-status.warning {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning-color);
}

.btn-add {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    background: rgba(76, 175, 80, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-add:hover {
    background: rgba(76, 175, 80, 1);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

/* Table Styles */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.5);
}

.data-table tr:hover {
    background: rgba(76, 175, 80, 0.05);
}

.action-btns {
    display: flex;
    gap: 8px;
}

.btn-table {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-edit { background: #3498db; color: white; }
.btn-delete { background: #e74c3c; color: white; }
.btn-qr { background: #9b59b6; color: white; }

.btn-table:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 600px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalSlideDown 0.3s ease-out;
}

@keyframes modalSlideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--hover-bg);
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover { color: var(--text-primary); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    font-family: inherit;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary-color);
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-img {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-group {
    display: flex;
    gap: 20px;
}

.checkbox-group label {
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--hover-bg);
}

/* QR Card Styles */
.qr-modal-content {
    width: 400px;
}

.qr-display-area {
    padding: 30px;
    display: flex;
    justify-content: center;
}

.qr-card {
    width: 100%;
    padding: 20px;
    border: 2px solid #eee;
    border-radius: 12px;
    text-align: center;
    background: white;
}

.qr-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.qr-header img { height: 30px; }
.qr-header h3 { font-size: 16px; color: var(--primary-color); }

#qrCodeImage {
    margin: 20px auto;
    padding: 10px;
    background: white;
    display: inline-block;
}

.qr-info {
    text-align: left;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.6;
}

.qr-footer {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.trace-preview-section {
    padding: 0 24px 24px;
    max-height: 300px;
    overflow-y: auto;
}

.trace-preview-section h3 {
    font-size: 16px;
    margin: 15px 0 10px;
    color: var(--text-primary);
}

.preview-article {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    background: #f9f9f9;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.preview-images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.gallery-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Print Styles */
@media print {
    body * { visibility: hidden; }
    #printableQR, #printableQR * { visibility: visible; }
    #printableQR {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* Responsive Design */
@media (max-width: 1400px) {
    .current-crops,
    .crop-progress,
    .recent-activities,
    .activities-chart,
    .harvest-yield,
    .certificates-status {
        grid-column: span 12;
    }
}

@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 999;
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .btn-menu-toggle {
        display: flex;
    }

    .dashboard {
        padding: 24px;
        border-radius: 0;
    }

    .topbar {
        padding: 20px 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 16px;
    }

    .topbar-left {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
    }

    .topbar-right {
        flex-shrink: 0;
    }

    .page-title {
        font-size: 18px !important;
        margin-bottom: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .page-subtitle {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dashboard {
        padding: 20px 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-card .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .stat-info h3 {
        font-size: 28px;
    }

    .dashboard-grid {
        gap: 16px;
    }

    .widget {
        padding: 20px;
    }

    .widget-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .widget-select {
        width: 100%;
    }

    .crops-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .chart-stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .chart-stat-item .stat-number {
        font-size: 24px;
    }

    .yield-stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .activity-item {
        padding: 12px;
        gap: 12px;
    }

    .activity-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .activity-title {
        font-size: 13px;
    }

    .activity-time {
        font-size: 11px;
    }

    .btn-add {
        padding: 10px 16px;
        font-size: 13px;
    }

    .certificate-card {
        flex-direction: column;
        text-align: center;
    }

    .cert-icon {
        margin-bottom: 8px;
    }

    /* Touch-friendly button sizes */
    .btn-icon,
    .btn-menu-toggle {
        min-width: 48px;
        min-height: 48px;
    }

    .nav-item {
        padding: 16px 20px;
        font-size: 16px;
    }

    .nav-item i {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 85vw;
        max-width: 320px;
    }

    .page-title {
        font-size: 16px !important;
    }

    .dashboard {
        padding: 16px 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-info h3 {
        font-size: 24px;
    }

    .stat-info p {
        font-size: 12px;
    }

    .widget {
        padding: 16px;
    }

    .widget-header h2 {
        font-size: 16px;
    }

    .chart-container {
        height: 200px !important;
    }

    .crop-card {
        padding: 20px;
    }

    .crop-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .crop-card h3 {
        font-size: 14px;
    }
}

/* Tooltip Styles */
.tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Content Sections */
.content-section {
    display: none;
    width: 100%;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cultivation Diary Specific Styles */
.season-progress-container {
    background: var(--hover-bg);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 15px;
}

.progress-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-label span:first-child {
    font-weight: 700;
    font-size: 20px;
    color: var(--text-primary);
}

.progress-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-color);
}

.progress-meta {
    display: flex;
    gap: 30px;
    margin-top: 15px;
    font-size: 14px;
    color: var(--text-secondary);
}

.progress-meta i {
    margin-right: 8px;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .progress-meta {
        flex-direction: column;
        gap: 10px;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f5f7fa;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}
