/* =========================================
   1. CORE VARIABLES & RESET
   ========================================= */
:root {
    --primary: #2ecc71;    /* Farm Green */
    --primary-dark: #27ae60;
    --bg-light: #f4f7f6;
    --bg-dark: #121212;
    --card-dark: #1e1e1e;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-light: #eee;
    --border-dark: #333;
    --farm-ink: #17352e;
    --farm-leaf: #3d8b61;
    --farm-lime: #b8d43d;
    --farm-border: #dce6df;
    --farm-muted: #64756d;
    --farm-canvas: #f3f6f2;
    --farm-surface: #ffffff;
    --farm-surface-soft: #fbfdfb;
    --farm-panel-border: #c9d9cc;
    --farm-divider: #e8eee9;
    --farm-control-border: #cbd5e1;
    --farm-control-radius: 5px;
    --farm-panel-radius: 8px;
    --farm-control-height: 40px;
    --farm-leaf-dark: #286640;
    --farm-focus-border: #6f9d51;
    --farm-focus-ring: rgba(184, 212, 61, 0.35);
    --farm-panel-shadow: 0 4px 16px rgba(23, 53, 46, 0.04);
    --farm-card-shadow: 0 5px 16px rgba(23, 53, 46, 0.05);
    --farm-record-shadow: 0 8px 24px rgba(23, 53, 46, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light); /* Default to light for Dashboard */
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
}

/* =========================================
   2. LAYOUT & CONTAINERS
   ========================================= */
.container {
    width: 100%;
    max-width: 1100px; /* Wider for the Dashboard Table */
    margin: 0 auto;
    padding: 20px;
}

/* Scoped layout for the Scanner/Login (Centering) */
.centered-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-dark);
    width: 100%;
}

.centered-layout .container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* =========================================
   3. NAVIGATION & LAYOUT
   ========================================= */

/* Page Layout Grid */
html, body {
    height: 100%;
}

body {
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto 1fr;
    grid-template-areas: 
        "topnav topnav"
        "sidebar main";
}

/* Top Navigation Bar */
.top-nav-bar {
    grid-area: topnav;
    background: #2c3e50;
    color: white;
    padding: 12px 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 20px;
    border-bottom: 4px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-nav-left {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 16px;
}

.top-nav-right {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 16px;
}

.menu-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 32px;
    height: 32px;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    opacity: 0.8;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-brand {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
}

.org-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.top-nav-icon-link {
    position: relative;
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    transition: all 0.2s ease;
    display: grid;
    place-items: center;
}

.top-nav-icon-link:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.top-nav-message-link {
    min-width: 32px;
    min-height: 32px;
}

.top-nav-message-link.has-unread {
    color: #f6c47b;
}

.top-nav-message-link.is-new .top-nav-message-badge {
    animation: top-nav-message-pulse 1.4s ease-out 2;
}

.top-nav-message-badge {
    position: absolute;
    top: -6px;
    right: -9px;
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #2c3e50;
    border-radius: 999px;
    background: #df765b;
    color: #fff;
    font-size: .64rem;
    font-weight: 800;
    line-height: 1;
}

.top-nav-message-badge[hidden] {
    display: none;
}

@keyframes top-nav-message-pulse {
    0% { box-shadow: 0 0 0 0 rgba(223,118,91,.65); }
    70% { box-shadow: 0 0 0 8px rgba(223,118,91,0); }
    100% { box-shadow: 0 0 0 0 rgba(223,118,91,0); }
}

/* Sidebar Navigation */
.sidebar-nav {
    grid-area: sidebar;
    background: white;
    width: 220px;
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    padding: 20px 0;
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    height: calc(100vh - 56px);
    z-index: 90;
}

.sidebar-section {
    padding: 0 12px;
    margin-bottom: 24px;
}

.sidebar-section:last-child {
    margin-top: auto;
}

.sidebar-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    margin-bottom: 8px;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-link:hover {
    background: rgba(46, 204, 113, 0.08);
    color: var(--primary);
}

.sidebar-link.active {
    background: rgba(46, 204, 113, 0.15);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    padding-left: 9px;
}

.sidebar-icon {
    font-size: 1.1rem;
    display: block;
}

.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-link {
    color: #e74c3c;
}

.logout-link:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
}

/* Sidebar Submenu Styling */
.sidebar-submenu-group {
    display: flex;
    flex-direction: column;
}

.sidebar-submenu-toggle {
    display: grid;
    grid-template-columns: 24px 1fr 20px;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.sidebar-submenu-toggle:hover {
    background: rgba(46, 204, 113, 0.08);
    color: var(--primary);
}

.sidebar-submenu-toggle.active {
    background: rgba(46, 204, 113, 0.15);
    color: var(--primary);
}

.submenu-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 0.9rem;
}

.sidebar-submenu-toggle.expanded .submenu-arrow {
    transform: rotate(90deg);
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding-left: 12px;
    border-left: 2px solid rgba(46, 204, 113, 0.3);
    margin-left: 6px;
}

.sidebar-submenu.expanded {
    display: flex;
}

.submenu-item {
    padding: 8px 12px;
    font-size: 0.9rem;
    opacity: 0.85;
    border-radius: 4px;
}

.submenu-item:hover {
    opacity: 1;
    background: rgba(46, 204, 113, 0.08);
}

.submenu-item.active {
    opacity: 1;
    background: rgba(46, 204, 113, 0.15);
    color: var(--primary);
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 85;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    opacity: 1;
}

.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    background: transparent;
    border: none;
}

/* Main Content Area */
.container {
    grid-area: main;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    overflow-y: auto;
}

/* Desktop Sidebar (768px and up) */
@media (min-width: 768px) {
    body {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "topnav"
            "main";
    }
    
    .sidebar-overlay {
        display: block !important;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 90;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }
    
    .sidebar-close-btn {
        display: none !important;
    }
    
    .sidebar-nav {
        position: fixed;
        left: 0;
        top: 56px;
        width: 220px;
        height: calc(100vh - 56px);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 95;
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    }
    
    .sidebar-nav.open {
        transform: translateX(0);
    }
}

/* Mobile Hamburger Menu (<768px) */
@media (max-width: 767px) {
    body {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "topnav"
            "main";
    }
    
    .sidebar-nav {
        position: fixed;
        left: 0;
        top: 56px;
        width: 240px;
        height: calc(100vh - 56px);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 95;
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    }
    
    .sidebar-nav.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }
    
    .sidebar-overlay.open {
        pointer-events: auto;
    }
    
    .sidebar-close-btn {
        display: block;
    }
    
    .container {
        padding: 16px;
    }
    
    .nav-brand {
        font-size: 0.9rem;
    }
    
    .org-badge {
        display: none;
    }
}

/* Scrollable container setup */
.main-content {
    display: flex;
    flex-direction: column;
}

/* =========================================
   4. TABLES & DATA
   ========================================= */
.modern-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.modern-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.modern-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-light);
}

/* =========================================
   5. SCANNER THEME (DARK MODE SCOPED)
   ========================================= */
.scanner-theme {
    background-color: var(--bg-dark);
    color: #f5f5f5;
}

.scanner-theme .card {
    background: var(--card-dark);
    border-color: var(--border-dark);
    max-width: 500px;
}

.rfid-badge {
    background: #000;
    color: var(--primary);
    font-family: monospace;
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--primary);
    margin: 20px 0;
}

/* =========================================
   6. FORMS & BUTTONS
   ========================================= */
input[type="text"], select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.scanner-theme input[type="text"] {
    background: #2a2a2a;
    border: 2px solid var(--border-dark);
    color: white;
    padding: 15px;
}

.scanner-theme input[type="password"] {
    background: #2a2a2a;
    border: 2px solid var(--border-dark);
    color: white;
    padding: 15px;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}

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

/* =========================================
   8. FARM THEME BADGES (REFINED)
   ========================================= */

/* Roles */
.role-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Shades of the Farm: Green for Owners, Slate for Viewers */
.role-badge.owner  { background: #1b4332; color: #95d5b2; } /* Deep Forest */
.role-badge.editor { background: #e9edc9; color: #606c38; } /* Moss/Olive */
.role-badge.viewer { background: #f8f9fa; color: #6c757d; border: 1px solid #dee2e6; } 

/* Status & Tags */
.status-pill.available { 
    background: #d8f3dc; 
    color: #1b4332; 
}

.status-pill.assigned { 
    background: #2d6a4f; 
    color: #ffffff; 
}

/* Location Pills - Made to look like ear-tag plastic */
.location-pill {
    background: #fdf0d5; /* Light cream */
    color: #669bbc;    /* Muted blue */
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
    border-bottom: 2px solid #edede9;
}

/* The Live Pulse (Registration Active) */
.pulse-dot {
    height: 8px;
    width: 8px;
    background-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 0 rgba(46, 204, 113, 0.4);
    animation: pulse 2s infinite;
}

/* =========================================
   9. AUTH FORM STYLING (LOGIN/REGISTER)
   ========================================= */
.centered-layout .card {
    width: 100%;
    max-width: 400px;
    background: white;
    color: var(--text-main);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.centered-layout .card h1,
.centered-layout .card h2 {
    margin-top: 0;
}

.centered-layout input[type="text"],
.centered-layout input[type="email"],
.centered-layout input[type="password"],
.centered-layout select {
    background: white;
    border: 1px solid #ddd;
    color: var(--text-main);
    margin-bottom: 15px;
}

.centered-layout input[type="text"]:focus,
.centered-layout input[type="email"]:focus,
.centered-layout input[type="password"]:focus,
.centered-layout select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.centered-layout button {
    margin-top: 10px;
    transition: background 0.3s ease;
}

.error-alert {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #f5c6cb;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
}

.reg-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.option-card {
    padding: 15px;
    border: 2px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-card:hover {
    border-color: var(--primary);
    background: rgba(46, 204, 113, 0.05);
}

.option-card input[type="radio"] {
    margin-right: 10px;
}

.option-card strong {
    display: block;
    margin-bottom: 5px;
}

.option-card span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

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

/* =========================================
   10. PAGE HEADERS & SECTIONS
   ========================================= */
.page-header {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.page-header h1 {
    margin: 0 0 10px 0;
    font-size: 2rem;
}

.page-header .subtitle {
    margin: 0;
    opacity: 0.95;
    font-size: 0.95rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.4rem;
}

.section-header .badge-count {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* =========================================
   11. PAGE WRAPPER & CONTENT LAYOUT
   ========================================= */

/* Ensure body content area animates in */
.container {
    animation: pageSlideIn 0.3s ease 0.1s both;
}

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

.page-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.content-wrapper {
    width: 100%;
}

.content-wrapper .main-content {
    width: 100%;
}

.content-wrapper .main-content.full-width {
    flex: 1;
}

/* Ensure consistent spacing for main content cards */
.main-content .card,
.main-content .section {
    margin-bottom: 24px;
    animation: fadeInUp 0.3s ease;
}

.main-content .card:last-child,
.main-content .section:last-child {
    margin-bottom: 0;
}

/* Sidebar card consistency */
.sidebar-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.sidebar-card h3 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.sidebar-stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.3px;
    display: block;
    margin-bottom: 6px;
}

.sidebar-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

/* Consistent cards grid for content areas */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

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

/* Responsive adjustments */
@media (max-width: 1200px) {
    .page-wrapper {
        gap: 20px;
    }
    
    .page-header {
        padding: 32px 24px;
        margin-bottom: 24px;
    }
    
    .page-header h1 {
        font-size: 1.6rem;
    }
}

@media (max-width: 768px) {
    .page-wrapper {
        gap: 16px;
    }
    
    .page-header {
        padding: 24px 16px;
        margin-bottom: 16px;
        border-radius: 8px;
    }
    
    .page-header h1 {
        font-size: 1.4rem;
    }
    
    .page-header .subtitle {
        font-size: 0.9rem;
    }
    
    .sidebar-container {
        flex-direction: column !important;
    }
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.back-link:hover {
    transform: translateX(-3px);
}

/* =========================================
   11. ENHANCED CARD STYLING
   ========================================= */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.card h2 {
    margin-top: 0;
    color: var(--text-main);
    font-size: 1.2rem;
}

.card h3 {
    margin: 0 0 10px 0;
    color: var(--text-main);
}

.card p {
    margin: 8px 0;
}

.card p:last-child {
    margin-bottom: 0;
}

/* =========================================
   12. FORM ENHANCEMENTS
   ========================================= */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.btn-action {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-action:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #c0392b;
}

/* =========================================
   13. RESPONSIVE GRID LAYOUTS
   ========================================= */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

@media (min-width: 1200px) {
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

@media (min-width: 1200px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================
   14. ANIMATIONS
   ========================================= */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

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

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.3s;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

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

/* =========================================
   15. SIDEBAR LAYOUT (Desktop-Optimized)
   ========================================= */
.sidebar-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.sidebar {
    flex: 0 0 280px;
    position: sticky;
    top: 20px;
}

.main-content {
    flex: 1;
    min-width: 0;
    width: 100%;
}

@media (max-width: 1200px) {
    .sidebar-container {
        flex-direction: column;
        gap: 20px;
    }

    .sidebar {
        flex: 0 1 auto;
        width: 100%;
        position: static;
    }

    .main-content {
        width: 100%;
    }
}

/* Sidebar nav menu */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.sidebar-menu-item {
    padding: 14px 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    text-align: left;
    border-left: 3px solid transparent;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
}

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

.sidebar-menu-item.active {
    color: var(--primary);
    background: rgba(44, 187, 82, 0.05);
    border-left-color: var(--primary);
}

.sidebar-menu-item:hover {
    background: #f9f9f9;
    color: var(--text-main);
}

/* Sidebar card (for stats/filters) */
.sidebar-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.sidebar-card h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: var(--text-main);
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
}

.sidebar-card p {
    margin: 10px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.sidebar-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-stat:hover {
    background-color: #f5f5f5;
}

.sidebar-stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-divider {
    margin: 12px 0;
    border: none;
    border-top: 1px solid #eee;
}

.sidebar-section {
    padding: 0;
}

.sidebar-section-title {
    display: block;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.sidebar-label {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar-select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    flex: 1;
    background-color: white;
    color: var(--text-main);
}

.sidebar-select:hover {
    border-color: var(--primary);
}

.sidebar-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

/* =========================================
   CAMERA PROFILE - NEW VIEWS & TABS
   ========================================= */

/* Overview Tab Styles */
.overview-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    animation: slideIn 0.3s ease;
}

.overview-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.status-item {
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 3px solid #2ecc71;
}

.status-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 6px;
}

.status-value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 600;
}

.status-value.active {
    background: #e8f8f5;
    color: #27ae60;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 700;
}

.status-value.inactive {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 700;
}

.device-id-small {
    font-family: monospace;
    font-size: 0.8rem;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.stat-box {
    background: #f9f9f9;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #eee;
    border-left: 3px solid var(--primary);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.btn-action {
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-action.btn-primary {
    background: #2ecc71;
    color: white;
}

.btn-action.btn-primary:hover {
    background: #27ae60;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.btn-action.btn-secondary {
    background: #3498db;
    color: white;
}

.btn-action.btn-secondary:hover {
    background: #2980b9;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.recent-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-item:hover .recent-thumbnail {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.recent-thumbnail {
    position: relative;
    aspect-ratio: 1;
    background: #f5f5f5;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border: 1px solid #eee;
}

.thumbnail-emoji {
    font-size: 2.5rem;
}

.duration-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
}

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

.recent-time {
    font-weight: 600;
    color: var(--text-main);
}

.recent-size {
    font-size: 0.7rem;
}

.view-all-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.view-all-link:hover {
    text-decoration: underline;
}

.view-more-hint {
    text-align: center;
    margin-top: 12px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.view-more-hint a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
}
/* Dashboard Captures Grid */
.captures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
}

.capture-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
}

.capture-card:hover {
    transform: translateY(-4px);
}

.capture-thumbnail {
    position: relative;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eee;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.capture-thumbnail .thumbnail-emoji {
    font-size: 2.5rem;
}

.capture-info {
    background: white;
    padding: 8px;
    border: 1px solid #eee;
    border-top: none;
    border-radius: 0 0 8px 8px;
    font-size: 0.75rem;
}

.capture-camera {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.capture-time {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.capture-size {
    color: #bbb;
    font-size: 0.65rem;
}

.btn-secondary-small {
    display: inline-block;
    padding: 8px 14px;
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    color: var(--text-main);
}

.btn-secondary-small:hover {
    background: #d5dbdb;
}

.empty-state {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 8px;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.empty-state-text {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 0.9rem;
}

.breadcrumb-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.breadcrumb-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.breadcrumb-sep {
    color: var(--text-muted);
    font-weight: 300;
}

.breadcrumb-current {
    color: var(--text-main);
    font-weight: 600;
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.back-link:hover {
    color: var(--primary-dark);
    transform: translateX(-4px);
}

/* =========================================
   CAMERA REMOTE CONTROL STYLES
   ========================================= */

.camera-remote-control {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.remote-section {
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.remote-section h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-remote {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-remote:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-remote:active:not(:disabled) {
    transform: translateY(0);
}

.btn-remote:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-capture {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-settings {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-reset {
    background: #ecf0f1;
    color: var(--text-main);
    border: 1px solid #bdc3c7;
}

.btn-reset:hover:not(:disabled) {
    background: #d5dbdb;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.setting-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-control label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.setting-control input[type="number"],
.setting-control input[type="text"],
.setting-control select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-main);
    background: white;
}

.setting-control input[type="number"]:focus,
.setting-control input[type="text"]:focus,
.setting-control select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.setting-control small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 6px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* =========================================
   COMMAND HISTORY STYLES
   ========================================= */

.command-history-container {
    animation: slideIn 0.3s ease;
}

.history-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 150px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.filter-select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    color: var(--text-main);
    cursor: pointer;
    min-width: 150px;
}

.search-box:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.command-history {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #f9f9f9;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    margin-bottom: 8px;
    background: white;
    border-left: 4px solid #2ecc71;
    border-radius: 6px;
    transition: all 0.2s;
}

.history-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateX(2px);
}

.history-item.pending {
    border-left-color: #f39c12;
    background: #fffbf5;
}

.history-item.failed {
    border-left-color: #e74c3c;
    background: #fef5f4;
}

.history-icon {
    font-size: 1.5rem;
    min-width: 28px;
    text-align: center;
    line-height: 1.2;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 12px;
}

.history-command {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.history-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

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

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

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

.history-time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.history-details strong {
    color: var(--text-main);
}

/* =========================================
   MEDIA LIBRARY STYLES
   ========================================= */

.media-library-container {
    animation: slideIn 0.3s ease;
}

.media-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-badge {
    display: inline-block;
    background: #f0f0f0;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid #e0e0e0;
}

.media-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f0f0f0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.filter-buttons,
.view-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn,
.view-btn {
    padding: 8px 14px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-main);
}

.filter-btn:hover,
.view-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(46, 204, 113, 0.05);
}

.filter-btn.active,
.view-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.date-input {
    flex: 1;
    min-width: 120px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.sort-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    color: var(--text-main);
}

.media-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    min-height: 200px;
}

.media-grid-view.list-view {
    grid-template-columns: 1fr;
}

.media-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.media-card:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    transform: translateY(-4px);
    border-color: var(--primary);
}

.media-thumbnail {
    position: relative;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f5f5f5 0%, #ececec 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.list-view .media-thumbnail {
    width: 100px;
    min-width: 100px;
    height: 100px;
    aspect-ratio: auto;
}

.thumbnail-emoji {
    font-size: 3.5rem;
    opacity: 0.8;
}

.duration-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.media-hover-actions {
    position: absolute;
    inset: 0;
    display: none;
    background: rgba(0,0,0,0.65);
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 4px;
}

.media-card:hover .media-hover-actions {
    display: flex;
}

.action-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.25);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.action-btn:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.1);
}

.media-info {
    padding: 12px;
    font-size: 0.85rem;
}

.media-date {
    font-weight: 600;
    color: var(--text-main);
}

.media-time,
.media-size {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

.list-view .media-card {
    display: flex;
    gap: 12px;
}

.list-view .media-info {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.batch-actions {
    margin-top: 16px;
    padding: 12px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    text-align: center;
}

/* =========================================
   12. FULL-WIDTH PAGE LAYOUTS (Modern Dashboard Style)
   ========================================= */

.full-width-page-wrapper {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 0;
    height: 100%;
}

.full-width-header {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    padding: 32px 24px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

.full-width-header h1 {
    margin: 0 0 6px 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.full-width-header p {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 400;
}

.farm-page-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(280px, .9fr) minmax(0, 1.5fr);
    gap: 28px;
    align-items: center;
    overflow: hidden;
    padding: 34px clamp(20px, 4vw, 56px) 30px;
    border-bottom: 0;
    background: linear-gradient(120deg, #17352e 0%, #245342 58%, #49734d 100%);
    color: #fff;
}

.farm-page-hero::after {
    position: absolute;
    inset: 0;
    pointer-events: none;
    content: '';
    opacity: .18;
    background-image: linear-gradient(135deg, transparent 0 46%, rgba(184, 212, 61, .4) 46% 47%, transparent 47% 100%);
    background-size: 34px 34px;
}

.farm-page-hero-copy,
.farm-page-hero-metrics {
    position: relative;
    z-index: 1;
}

.farm-page-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: var(--farm-lime);
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.farm-page-hero h1 {
    margin: 0 0 7px;
    color: #fff;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1;
}

.farm-page-hero p {
    max-width: 620px;
    margin: 0;
    color: rgba(255, 255, 255, .78);
    font-size: .98rem;
}

.farm-page-hero-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.farm-page-hero-action {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border: 1px solid var(--farm-lime);
    border-radius: 5px;
    background: var(--farm-lime);
    color: var(--farm-ink);
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
}

.farm-page-hero-action:hover { background: #d5e765; }

.farm-page-hero-action.secondary {
    border-color: rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.farm-page-hero-action.secondary:hover { background: rgba(255, 255, 255, .17); }

.farm-page-hero-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid rgba(255, 255, 255, .3);
    border-bottom: 1px solid rgba(255, 255, 255, .3);
}

.farm-page-hero-metrics-1 { grid-template-columns: minmax(0, 1fr); }
.farm-page-hero-metrics-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.farm-page-hero-metrics-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.farm-page-metric {
    display: grid;
    min-width: 0;
    min-height: 92px;
    gap: 5px;
    align-content: center;
    padding: 12px 15px;
    border-left: 1px solid rgba(255, 255, 255, .2);
}

.farm-page-metric:first-child { border-left: 0; }

.farm-page-metric span {
    color: rgba(255, 255, 255, .7);
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
}

.farm-page-metric strong {
    color: #fff;
    font-size: 1.55rem;
    line-height: 1;
}

.farm-page-metric small {
    color: rgba(255, 255, 255, .7);
    font-size: .68rem;
    line-height: 1.25;
}

.farm-page-metric.attention strong { color: #ffd49e; }

@media (max-width: 1000px) {
    .farm-page-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
    }
}

@media (max-width: 800px) {
    .farm-page-hero { padding: 28px 18px 24px; }
}

@media (max-width: 560px) {
    .farm-page-hero-metrics,
    .farm-page-hero-metrics-3,
    .farm-page-hero-metrics-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .farm-page-metric:nth-child(odd) { border-left: 0; }
    .farm-page-metric:nth-child(n+3) { border-top: 1px solid rgba(255, 255, 255, .2); }
    .farm-page-metric { min-height: 78px; padding: 10px 8px; }
    .farm-page-metric strong { font-size: 1.35rem; }
}

.full-width-content {
    padding: 24px;
    background: #f8f9fa;
    overflow-y: auto;
}

.full-width-content > .card:first-child {
    animation: fadeIn 0.3s ease;
}

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

/* Modern content cards for full-width pages */
.content-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 24px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.content-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.content-card:last-child {
    margin-bottom: 0;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.list-header h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.3rem;
    font-weight: 600;
}

.list-header-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.list-header-actions button {
    padding: 10px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
    width: auto;
}

/* Modern list/grid view */
.modern-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    background: white;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.list-item:hover {
    background: #f9f9f9;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 8px 0;
    font-size: 1rem;
}

.list-item-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.list-item-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.list-item-actions {
    display: flex;
    gap: 8px;
    margin-left: 16px;
    flex-shrink: 0;
}

.list-item-actions a,
.list-item-actions button {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    width: auto;
    margin: 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.list-item-actions a:hover,
.list-item-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Empty state styling */
.empty-state-container {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state-message {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.empty-state-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.empty-state-actions button {
    width: auto;
    padding: 10px 20px;
}

/* Responsive adjustments for full-width pages */
@media (max-width: 768px) {
    .full-width-header {
        padding: 24px 16px;
    }

    .full-width-header h1 {
        font-size: 1.4rem;
    }

    .full-width-content {
        padding: 16px;
    }

    .content-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-header-actions {
        width: 100%;
    }

    .list-header-actions button {
        width: 100%;
    }

    .list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .list-item-actions {
        margin-left: 0;
        width: 100%;
    }

    .list-item-actions a,
    .list-item-actions button {
        width: 48%;
    }

    .list-item-meta {
        width: 100%;
    }
}
