/* Deep South Dairies - Modern Farm Dashboard */
:root {
    --primary: #1e3a5f;
    --primary-dark: #0f1f35;
    --primary-light: #2d5a8a;
    --accent: #3498db;
    --accent-light: #5dade2;
    --bg-dark: #0a1628;
    --bg-card: #ffffff;
    --bg-sidebar: #0f1f35;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --text-white: #ffffff;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: var(--text-dark);
    line-height: 1.6;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo i {
    font-size: 28px;
    color: var(--accent);
}

.logo span {
    color: var(--text-white);
    font-size: 18px;
    font-weight: 600;
}

.nav-menu {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-white);
}

.nav-item.active {
    background: var(--accent);
    color: var(--bg-sidebar);
}

.nav-item i {
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    font-size: 13px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    max-width: calc(100% - 260px);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

.header h1 .greeting-time {
    font-weight: 400;
    color: var(--text-light);
    font-size: 20px;
}

.header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.weather-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.weather-widget i {
    font-size: 24px;
    color: var(--warning);
}

.weather-temp {
    font-weight: 600;
    font-size: 18px;
}

.weather-desc {
    color: var(--text-light);
}

.date-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text-light);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.milk-production .stat-icon {
    background: #e3f2fd;
    color: #1976d2;
}

.herd-stats .stat-icon {
    background: #f3e5f5;
    color: #7b1fa2;
}

.grazing-stats .stat-icon {
    background: #e8f5e9;
    color: var(--primary);
}

.revenue-stats .stat-icon {
    background: #fff3e0;
    color: #f57c00;
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.stat-change {
    font-size: 13px;
    font-weight: 500;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

.stat-change.neutral {
    color: var(--text-light);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--primary);
}

.period-select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: white;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
}

/* Production Chart */
.production-card {
    grid-column: span 2;
}

.chart-container {
    padding: 24px;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    gap: 12px;
}

.bar {
    flex: 1;
    background: linear-gradient(to top, var(--primary), var(--primary-light));
    border-radius: 8px 8px 0 0;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 20px;
}

.bar:hover {
    opacity: 0.8;
}

.bar.active {
    background: linear-gradient(to top, var(--accent), var(--accent-light));
}

.bar-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    text-align: center;
    color: var(--text-light);
    line-height: 1.4;
}

/* Paddock Cards */
.paddock-card {
    grid-column: span 1;
}

.paddock-image {
    height: 160px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    position: relative;
    display: flex;
    align-items: flex-end;
}

.paddock-image.next-paddock {
    background: linear-gradient(135deg, #5c6bc0 0%, #7986cb 100%);
}

.paddock-overlay {
    padding: 20px;
    color: white;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

.paddock-badge {
    background: var(--accent);
    color: var(--bg-sidebar);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 8px;
}

.paddock-badge.upcoming {
    background: #5c6bc0;
    color: white;
}

.paddock-overlay h3 {
    font-size: 22px;
    margin-bottom: 4px;
}

.paddock-overlay p {
    font-size: 14px;
    opacity: 0.9;
}

.paddock-actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.paddock-details {
    padding: 16px 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row span {
    color: var(--text-light);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 13px;
}

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 13px;
}

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

/* Tasks Card */
.tasks-card {
    grid-column: span 1;
}

.badge {
    background: #fee2e2;
    color: var(--danger);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.task-list {
    padding: 16px 20px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}

.task-item:last-child {
    border-bottom: none;
}

.task-checkbox {
    position: relative;
    cursor: pointer;
}

.task-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 22px;
    height: 22px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.task-checkbox input:checked + .checkmark {
    background: var(--success);
    border-color: var(--success);
}

.task-checkbox input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 14px;
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.task-time {
    font-size: 12px;
    color: var(--text-light);
}

.task-priority {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f1f5f9;
    color: var(--text-light);
}

.task-priority.high {
    background: #fee2e2;
    color: var(--danger);
}

.btn-view-all {
    width: 100%;
    padding: 16px;
    background: #f8fafc;
    border: none;
    border-top: 1px solid #f1f5f9;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-view-all:hover {
    background: #f1f5f9;
}

/* Gauge Card */
.gauge-card {
    grid-column: span 1;
}

.gauge-container {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.gauge {
    position: relative;
    width: 140px;
    height: 70px;
}

.gauge-body {
    width: 140px;
    height: 70px;
    background: #e2e8f0;
    border-radius: 70px 70px 0 0;
    position: relative;
    overflow: hidden;
}

.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: inherit;
    height: inherit;
    background: linear-gradient(to right, var(--primary), var(--accent));
    transform-origin: center bottom;
    transform: rotate(0.5turn);
    transition: transform 0.5s ease;
}

.gauge-cover {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 50px;
    background: white;
    border-radius: 50px 50px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.gauge-label {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-light);
}

.gauge-stats {
    flex: 1;
}

.gauge-stat {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.gauge-stat:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-light);
    font-size: 14px;
}

.stat-value {
    font-weight: 600;
    color: var(--text-dark);
}

/* Quick Actions */
.quick-actions-card {
    grid-column: span 1;
}

.quick-actions {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.action-btn i {
    font-size: 24px;
    color: var(--primary);
}

.action-btn:hover i {
    color: white;
}

.action-btn span {
    font-size: 13px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .production-card {
        grid-column: span 2;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar span {
        display: none;
    }
    
    .main-content {
        margin-left: 80px;
        max-width: calc(100% - 80px);
    }
    
    .nav-item {
        justify-content: center;
        padding: 14px;
    }
    
    .sidebar-footer {
        display: none;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .production-card {
        grid-column: span 1;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* New Layout Styles */
.stats-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
}

.grazing-section-full {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.grazing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.grazing-header h2 {
    font-size: 20px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.grazing-cards-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.paddock-card.expanded {
    display: flex;
    flex-direction: column;
}

.paddock-card.expanded .paddock-details {
    flex: 1;
}

.paddock-card.next {
    opacity: 0.9;
}

.paddock-details.compact .detail-row {
    padding: 10px 0;
    font-size: 13px;
}

.grazing-section-full .btn-view-all {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.grazing-section-full .btn-view-all:hover {
    color: var(--accent);
}

.production-card.full-width {
    grid-column: 1 / -1;
    margin-top: 24px;
}

/* Production + Performance row layout */
.production-performance-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

.production-card.side-by-side {
    margin: 0;
}

.gauge-card.side-by-side {
    margin: 0;
}

.gauge-card.side-by-side .gauge-container {
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

/* AM / PM / Tomorrow Grazing Layout */
.grazing-am-pm-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grazing-time-section {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.time-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.time-header.am {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border-bottom: none;
}

.time-header.pm {
    background: linear-gradient(135deg, #3498db, #5dade2);
    color: white;
    border-bottom: none;
}

.time-header.tomorrow {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    border-bottom: none;
}

.time-header h3 {
    font-size: 16px;
    flex: 1;
}

.time-header i {
    font-size: 18px;
}

.time-badge {
    background: rgba(255,255,255,0.25);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.paddock-mini-card {
    background: white;
}

.mini-paddock-header {
    padding: 16px;
    color: white;
}

.mini-paddock-header h4 {
    font-size: 20px;
    margin-bottom: 4px;
}

.mini-paddock-header p {
    font-size: 13px;
    opacity: 0.9;
}

.mini-badge {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.mini-paddock-details {
    padding: 16px;
}

.mini-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}

.mini-row:last-child {
    border-bottom: none;
}

.mini-row span {
    color: var(--text-light);
}

.mini-row strong {
    color: var(--text-dark);
}

.paddock-mini-card.next-day {
    opacity: 0.95;
}

@media (max-width: 1200px) {
    .grazing-am-pm-row {
        grid-template-columns: 1fr;
    }
}

.quick-actions-card .action-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.quick-actions-card .action-btn.primary i {
    color: white;
}

.quick-actions-card .action-btn.primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
}

@media (max-width: 1200px) {
    .grazing-cards-row {
        grid-template-columns: 1fr;
    }
    
    .paddock-card.next {
        order: -1;
    }
    
    .stats-grid.three-col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid.three-col {
        grid-template-columns: 1fr;
    }
    
    .grazing-cards-row {
        grid-template-columns: 1fr;
    }
    
    .grazing-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
