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

/* Authentication Page Styles */
.auth-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 500px;
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.auth-logo-section {
    padding: 3rem 2rem 2rem 2rem;
    text-align: center;
    background: #ffffff;
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.auth-logo-text {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.auth-logo-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: #333;
    letter-spacing: -1px;
}

.auth-form-section {
    padding: 0 2rem 3rem 2rem;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0;
}

.auth-header p {
    color: #666;
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 400;
}

.auth-tabs {
    display: flex;
    margin-bottom: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 4px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #666;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
}

.auth-tab.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 2px 8px rgba(4, 78, 71, 0.3);
}

.auth-tab:hover:not(.active) {
    background: rgba(4, 78, 71, 0.1);
    color: var(--sidebar-active);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

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

.auth-form input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    background: #ffffff;
    color: #333;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 3px rgba(4, 78, 71, 0.1);
    transform: translateY(-1px);
}

.auth-form input::placeholder {
    color: #999;
    font-weight: 400;
}

.auth-btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.auth-btn.primary {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 4px 12px rgba(4, 78, 71, 0.3);
}

.auth-btn.primary:hover {
    background: #033a35;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(4, 78, 71, 0.4);
}

.forgot-password-link {
    color: var(--sidebar-active);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.auth-footer-link {
    color: #666;
    text-decoration: none;
    font-size: 0.85rem;
}

.auth-footer-link:hover {
    color: var(--sidebar-active);
    text-decoration: underline;
}

.auth-footer-separator {
    color: #ccc;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .auth-page {
        padding: 1rem;
    }
    
    .auth-container {
        border-radius: 16px;
    }
    
    .auth-logo-section {
        padding: 2rem 1.5rem 1.5rem 1.5rem;
    }
    
    .auth-form-section {
        padding: 0 1.5rem 2rem 1.5rem;
    }
    
    .auth-header h2 {
        font-size: 1.75rem;
    }
    
    .auth-logo-name {
        font-size: 28px;
    }
}

:root {
    --sidebar-bg: #212529;
    --sidebar-text: #ffffff;
    --sidebar-active: #044e47;
    --main-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-hover: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--main-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-org-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--sidebar-text);
    flex: 1;
}

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

.logo-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.2;
}

.logo-company {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sidebar-text);
    line-height: 1.2;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.app-name {
    padding: 1rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sidebar-text);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

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

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.logout-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
    min-height: 100vh;
    padding-top: 0;
}

/* Top Search Bar - Base styles, hidden on desktop by default */
.top-search-bar {
    position: sticky;
    top: 0;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    align-items: center;
    gap: 0.5rem;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Hidden by default, shown only on mobile via media query */
    display: none;
}

/* Explicitly hide on desktop screens (wider than 768px) */
@media (min-width: 769px) {
    #top-search-bar,
    .top-search-bar {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        border: none !important;
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
        width: 0 !important;
        max-width: 0 !important;
        min-width: 0 !important;
        z-index: -9999 !important;
    }
}

.hamburger-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 40px;
}

.hamburger-menu-btn:hover {
    background-color: var(--main-bg);
}

.global-search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: var(--main-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 3px rgba(4, 78, 71, 0.1);
}

.add-menu-btn {
    background: var(--sidebar-active);
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-menu-btn:hover {
    background-color: #033d37;
}

.add-menu-btn:hover {
    background-color: var(--main-bg);
}

.add-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    display: none;
    z-index: 1000;
    overflow: hidden;
}

.add-menu-dropdown.active {
    display: block;
}

.add-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
}

.add-menu-item:hover {
    background-color: var(--main-bg);
}

.add-menu-item svg {
    flex-shrink: 0;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
    gap: 0.75rem;
    min-width: 0;
}

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex-shrink: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.header-actions .btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Move Cattle Records title more to the left */
.main-content #cattle-section .content-header,
#cattle-section .content-header {
    justify-content: flex-start !important;
    gap: 1rem !important;
    padding-left: 0 !important;
    margin-left: -2rem !important;
    margin-right: 0 !important;
    width: calc(100% + 2rem) !important;
}

.main-content #cattle-section .content-header h1,
#cattle-section .content-header h1 {
    margin-right: auto !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: left !important;
    position: relative;
    left: 0 !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

/* Desktop: Ensure title doesn't get cut off by sidebar */
@media (min-width: 769px) {
    .main-content #cattle-section .content-header h1,
    #cattle-section .content-header h1 {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }
    
    .main-content #cattle-section .content-header,
    #cattle-section .content-header {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
    }
}

/* On mobile, adjust for mobile padding */
@media (max-width: 768px) {
    .main-content #cattle-section .content-header,
    #cattle-section .content-header {
        margin-left: -0.5rem !important;
        width: calc(100% + 0.5rem) !important;
        padding-left: 0 !important;
    }
    
    .main-content #cattle-section .content-header h1,
    #cattle-section .content-header h1 {
        margin-left: -0.5rem !important;
        padding-left: 0 !important;
        left: 0 !important;
    }
}

.search-container {
    margin-bottom: 1.5rem;
}

#scanner-status {
    display: none !important;
}

/* Users Table Styling */
#users-section .users-table-container {
    background: var(--card-bg) !important;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    margin-top: 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.5rem !important;
    box-sizing: border-box !important;
}

#users-section .data-table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    table-layout: auto;
    min-width: 100% !important;
}

#users-section .data-table thead {
    background: var(--main-bg);
}

#users-section .data-table th {
    padding: 1.75rem 2.5rem !important;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    font-size: 1.05rem;
}

#users-section .data-table td {
    padding: 1.75rem 2.5rem !important;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
    font-size: 1rem;
}

#users-section .data-table tbody tr {
    transition: background-color 0.2s ease;
}

#users-section .data-table tbody tr:hover {
    background-color: var(--main-bg);
}

#users-section .data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Users table specific spacing - more generous */
#users-table {
    width: 100% !important;
    min-width: 100% !important;
}

#users-table th {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    padding: 2rem 3rem !important;
}

#users-table td {
    font-size: 1.05rem !important;
    padding: 2rem 3rem !important;
}

/* Make Actions column wider for buttons */
#users-table th:last-child,
#users-table td:last-child {
    padding-right: 3.5rem !important;
    text-align: right;
}

#users-table td:last-child {
    display: flex !important;
    gap: 1rem !important;
    justify-content: flex-end;
    align-items: center;
}

/* Ensure table fills available space */
#users-section {
    width: 100% !important;
    max-width: 100% !important;
}

#users-section .main-content {
    width: 100% !important;
    max-width: 100% !important;
}

@media (max-width: 768px) {
    #users-section .users-table-container {
        padding: 1rem !important;
    }
    
    #users-section .data-table th,
    #users-section .data-table td {
        padding: 1rem 1.25rem !important;
        font-size: 0.85rem !important;
    }
    
    #users-table th,
    #users-table td {
        padding: 1.25rem 1.5rem !important;
    }
    
    #users-table th {
        font-size: 0.95rem !important;
    }
    
    #users-table td {
        font-size: 0.9rem !important;
    }
    
    #users-table td:last-child {
        gap: 0.5rem !important;
    }
}

.search-input {
    width: 100%;
    max-width: 300px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.1);
}

/* Section Styles */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Button Styles */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background-color: #033d37;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Card Styles */
.cattle-list,
.vaccines-list,
.protocols-list,
.pastures-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

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

.cattle-card,
.vaccine-card,
.protocol-card,
.pasture-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.tasks-list .cattle-card {
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.cattle-card:hover,
.vaccine-card:hover,
.protocol-card:hover,
.pasture-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.cattle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cattle-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cattle-card-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.tag-badge {
    background-color: var(--sidebar-active);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.cattle-card-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

.cattle-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.treatment-history {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.treatment-history h4 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.treatment-item {
    background: var(--main-bg);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.treatment-item strong {
    color: var(--text-primary);
}

.inventory-bar {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.inventory-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.inventory-bar-container {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.inventory-bar-fill {
    height: 100%;
    background: var(--sidebar-active);
    transition: width 0.3s ease;
}

.inventory-low {
    background: #ffc107;
}

.inventory-critical {
    background: #dc3545;
}

.protocol-tasks {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.task-item {
    background: var(--main-bg);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.task-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideUp 0.3s ease;
}

.modal-content.large {
    max-width: 900px;
}

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

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close:hover {
    color: var(--text-primary);
    background-color: var(--main-bg);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 600;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--card-bg);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--sidebar-active);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: var(--sidebar-active);
}

.form-group input[type="file"] {
    display: none;
}

.photo-preview-container {
    margin-top: 0.5rem;
}

.photo-preview-container img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    object-fit: contain;
    background: var(--main-bg);
    cursor: pointer;
    transition: transform 0.2s;
}

.photo-preview-container img:hover {
    transform: scale(1.02);
}

.form-group textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.task-form-item {
    background: var(--main-bg);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
}

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

.task-form-item-header h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.remove-task-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

.remove-task-btn:hover {
    background: #c82333;
}

.cattle-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.details-section {
    background: var(--main-bg);
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.details-section h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.details-item {
    margin-bottom: 0.75rem;
}

.details-item strong {
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.details-item span {
    color: var(--text-primary);
    font-size: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.empty-state svg {
    width: 120px;
    height: 120px;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Dashboard Styles */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-widget {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.dashboard-widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.widget-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.widget-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.widget-progress {
    margin-top: 1rem;
}

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

.progress-fill {
    height: 100%;
    background: var(--sidebar-active);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.widget-large {
    grid-column: span 2;
}

.widget-list {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.widget-list-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.widget-list-item-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.widget-list-item-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Customize Dashboard Modal */
.widget-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.widget-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.widget-option:hover {
    border-color: var(--sidebar-active);
    background-color: rgba(32, 201, 151, 0.05);
}

.widget-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: var(--sidebar-active);
}

.widget-option-label {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

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

    .widget-large {
        grid-column: span 1;
    }

    .widget-options {
        grid-template-columns: 1fr;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100% !important;
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: translateY(0) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1000 !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .sidebar-header {
        display: none;
    }

    .app-name {
        display: none;
    }

    .sidebar-nav {
        display: flex !important;
        flex-direction: row !important;
        padding: 0.25rem 0.4rem !important;
        overflow: visible !important;
        gap: 0.15rem !important;
        flex: 1 1 auto !important;
        height: 100% !important;
        justify-content: space-around !important;
        width: 100% !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }

    .nav-item {
        flex: 1 1 0 !important;
        flex-direction: column !important;
        padding: 0.3rem 0.15rem !important;
        min-width: 0 !important;
        gap: 0.15rem !important;
        font-size: 0.45rem !important;
        border-radius: 2px !important;
        align-items: center !important;
        justify-content: center !important;
        display: flex !important;
        visibility: visible !important;
        box-sizing: border-box !important;
        color: #ffffff !important;
        background: transparent !important;
    }

    /* SVG icon styling moved to mobile-fix.css for stability */
    
    .sidebar .sidebar-nav .nav-item.active,
    .nav-item.active {
        background-color: var(--sidebar-active) !important;
    }
    
    .sidebar .sidebar-nav .nav-item.active svg,
    .nav-item.active svg {
        color: #ffffff !important;
        stroke: #ffffff !important;
    }
    
    .sidebar .sidebar-nav .nav-item.active svg *,
    .nav-item.active svg path,
    .nav-item.active svg rect,
    .nav-item.active svg circle,
    .nav-item.active svg line {
        stroke: #ffffff !important;
        stroke-width: 2 !important;
        fill: none !important;
    }
    
    .sidebar .sidebar-nav .nav-item.active svg circle[fill],
    .sidebar .sidebar-nav .nav-item.active svg path[fill],
    .nav-item.active svg circle[fill],
    .nav-item.active svg path[fill] {
        fill: #ffffff !important;
        stroke: none !important;
    }

    .nav-item span {
        text-align: center !important;
        line-height: 1 !important;
        font-size: 0.5rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    /* Hide Calendar and Protocols on mobile bottom bar */
    button.nav-item[data-section="calendar"],
    button.nav-item[data-section="protocols"],
    .nav-item[data-section="calendar"],
    .nav-item[data-section="protocols"],
    .sidebar .sidebar-nav .nav-item[data-section="calendar"],
    .sidebar .sidebar-nav .nav-item[data-section="protocols"],
    aside.sidebar nav.sidebar-nav button.nav-item[data-section="calendar"],
    aside.sidebar nav.sidebar-nav button.nav-item[data-section="protocols"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* Ensure SVG icons are visible on mobile */
    .nav-item svg {
        width: 20px !important;
        height: 20px !important;
        display: block !important;
        color: #ffffff !important;
        stroke: #ffffff !important;
    }
    
    .nav-item svg path,
    .nav-item svg rect,
    .nav-item svg circle,
    .nav-item svg line {
        stroke: #ffffff !important;
        stroke-width: 2.5 !important;
    }
    
    .nav-item svg circle[fill],
    .nav-item svg path[fill] {
        fill: #ffffff !important;
    }

    .sidebar-footer {
        display: none;
    }
    
    /* Side menu (hamburger menu) styling for mobile */
    .side-menu {
        width: 280px !important;
        max-width: 85vw !important;
        z-index: 2000 !important;
    }
    
    .side-menu-item {
        padding: 0.7rem 1rem !important;
        font-size: 0.85rem !important;
    }
    
    .side-menu-item svg {
        width: 20px !important;
        height: 20px !important;
    }
    
    /* COMPREHENSIVE MOBILE SCALING - Override everything */
    /* Base font size reduction */
    html {
        font-size: 14px !important;
    }
    
    body {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
    }
    
    /* All buttons - very specific selectors */
    button,
    .btn,
    button.btn,
    button.btn-primary,
    button.btn-secondary,
    button.btn-danger,
    button.btn-small,
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-small,
    [class*="btn"] {
        padding: 0.4rem 0.65rem !important;
        font-size: 0.75rem !important;
        min-height: auto !important;
        line-height: 1.3 !important;
        border-radius: 4px !important;
    }
    
    .btn-small,
    button.btn-small {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.7rem !important;
    }
    
    /* All text elements */
    p, span, div, label, li, td, th {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
    }
    
    /* Headings */
    h1 {
        font-size: 1.3rem !important;
        line-height: 1.3 !important;
        margin: 0.4rem 0 !important;
    }
    
    h2 {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
        margin: 0.4rem 0 !important;
    }
    
    h3 {
        font-size: 1rem !important;
        line-height: 1.3 !important;
        margin: 0.3rem 0 !important;
    }
    
    h4 {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
        margin: 0.3rem 0 !important;
    }
    
    /* Form elements */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    select,
    textarea {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.8rem !important;
        border-radius: 4px !important;
        line-height: 1.4 !important;
    }
    
    label,
    .form-label {
        font-size: 0.8rem !important;
        margin-bottom: 0.3rem !important;
    }
    
    .form-group {
        margin-bottom: 0.6rem !important;
    }
    
    /* Cards and containers */
    .card {
        padding: 0.7rem !important;
        margin-bottom: 0.7rem !important;
        border-radius: 6px !important;
    }
    
    .content-header {
        padding: 0.5rem 0 !important;
        margin-bottom: 0.6rem !important;
    }
    
    /* Tables */
    table {
        font-size: 0.75rem !important;
    }
    
    th, td {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
    
    /* Lists */
    ul, ol {
        padding-left: 1.2rem !important;
    }
    
    /* Search container - keep buttons on one line */
    .search-container > div {
        flex-wrap: nowrap !important;
    }
    
    .search-input {
        max-width: 200px !important;
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
    }
    
    li {
        margin-bottom: 0.35rem !important;
        font-size: 0.85rem !important;
    }
    
    /* Modals */
    .modal-content {
        padding: 0.8rem !important;
        max-width: 95vw !important;
        border-radius: 6px !important;
    }
    
    .modal-header {
        padding: 0.6rem 0.8rem !important;
    }
    
    .modal-header h2,
    .modal-header h3 {
        font-size: 1.1rem !important;
    }
    
    .modal-body {
        padding: 0.6rem 0.8rem !important;
    }
    
    .modal-footer {
        padding: 0.6rem 0.8rem !important;
    }
    
    /* Content sections */
    .section {
        padding: 0.5rem !important;
    }
    
    .content-header h1 {
        font-size: 1.1rem !important;
        margin: 0 !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }
    
    #cattle-section .content-header h1 {
        font-size: 1rem !important;
        white-space: nowrap !important;
    }
    
    .header-actions {
        gap: 0.4rem !important;
    }
    
    .header-actions .btn {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.7rem !important;
    }
    
    /* Info items and labels */
    .info-label,
    .info-value {
        font-size: 0.8rem !important;
    }
    
    /* Badges and tags */
    .badge,
    .tag {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.7rem !important;
    }

    .menu-toggle {
        display: none;
    }

    .main-content {
        margin-left: 0 !important;
        margin-bottom: 52px !important;
        padding: 0.5rem !important;
        padding-top: 0 !important;
        overflow-x: visible !important;
    }
    
    /* Make all headings smaller */
    h1 {
        font-size: 1.5rem !important;
        margin: 0.5rem 0 !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
        margin: 0.5rem 0 !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
        margin: 0.4rem 0 !important;
    }
    
    /* Make cards and content smaller */
    .card {
        padding: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .content-header {
        padding: 0.5rem 0 !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Make ALL buttons smaller on mobile */
    button.btn,
    .btn,
    button.btn-primary,
    .btn-primary,
    button.btn-secondary,
    .btn-secondary,
    button.btn-danger,
    .btn-danger,
    button.btn-small,
    .btn-small,
    button[class*="btn"] {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.75rem !important;
        min-height: auto !important;
        line-height: 1.2 !important;
    }
    
    .btn-small {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.7rem !important;
    }
    
    /* Make all text smaller */
    body, p, span, div, label, input, select, textarea {
        font-size: 0.85rem !important;
    }
    
    /* Scale down headings more */
    h1 {
        font-size: 1.3rem !important;
        margin: 0.4rem 0 !important;
    }
    
    h2 {
        font-size: 1.1rem !important;
        margin: 0.4rem 0 !important;
    }
    
    h3 {
        font-size: 1rem !important;
        margin: 0.3rem 0 !important;
    }
    
    h4 {
        font-size: 0.9rem !important;
        margin: 0.3rem 0 !important;
    }
    
    /* Make forms and inputs smaller */
    input, select, textarea {
        padding: 0.5rem 0.6rem !important;
        font-size: 0.85rem !important;
    }
    
    .form-group {
        margin-bottom: 0.75rem !important;
    }
    
    label {
        font-size: 0.85rem !important;
        margin-bottom: 0.35rem !important;
    }
    
    /* Make tables smaller */
    table {
        font-size: 0.8rem !important;
    }
    
    th, td {
        padding: 0.5rem 0.6rem !important;
    }
    
    /* Make lists smaller */
    ul, ol {
        padding-left: 1.25rem !important;
    }
    
    li {
        margin-bottom: 0.4rem !important;
        font-size: 0.85rem !important;
    }
    
    /* Make modals smaller */
    .modal-content {
        padding: 1rem !important;
        max-width: 95vw !important;
    }
    
    .modal-header {
        padding: 0.75rem 1rem !important;
    }
    
    .modal-body {
        padding: 0.75rem 1rem !important;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem !important;
    }

    .top-search-bar {
        display: flex !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background-color: var(--sidebar-bg) !important;
        visibility: visible !important;
        opacity: 1 !important;
        padding: 0.5rem 0.6rem !important;
        gap: 0.5rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        align-items: center !important;
        height: auto !important;
        width: calc(100% + 1rem) !important;
        margin-left: -0.5rem !important;
        margin-right: -0.5rem !important;
        left: 0 !important;
    }
    
    .hamburger-menu-btn {
        min-width: 36px !important;
        width: 36px !important;
        height: 36px !important;
        padding: 0.3rem !important;
        background: none !important;
        border: none !important;
        color: white !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }
    
    .hamburger-menu-btn svg {
        width: 18px !important;
        height: 18px !important;
        stroke: white !important;
    }
    
    .add-menu-btn {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        background: var(--sidebar-active) !important;
        border-radius: 50% !important;
        color: white !important;
        flex-shrink: 0 !important;
    }
    
    .add-menu-btn svg {
        width: 20px !important;
        height: 20px !important;
        stroke-width: 2.5 !important;
    }
    
    .add-menu-btn:hover {
        background: #033d37 !important;
    }
    
    .global-search-input {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.85rem !important;
        flex: 1 !important;
        min-width: 0 !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 6px !important;
        color: white !important;
    }
    
    .global-search-input::placeholder {
        color: rgba(255, 255, 255, 0.7) !important;
    }

    .content-header {
        margin-top: 0.5rem;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: wrap !important;
    }
    
    .header-actions .btn {
        padding: 0.4rem 0.65rem !important;
        font-size: 0.75rem !important;
    }

    .cattle-list,
    .vaccines-list,
    .protocols-list {
        grid-template-columns: 1fr;
    }

    .cattle-card-info {
        grid-template-columns: 1fr;
    }

    .cattle-details-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }

    .hamburger-menu-btn {
        display: flex !important;
        background: none;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 4px;
        transition: background-color 0.2s;
    }

    .hamburger-menu-btn:hover {
        background-color: var(--main-bg);
    }
}

/* Ensure top search bar is completely hidden on desktop (after mobile media query) */
@media (min-width: 769px) {
    .top-search-bar {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        border: none !important;
        position: absolute !important;
    }
}

/* Side Menu Styles */
.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 2000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.side-menu.open {
    left: 0;
}

.side-menu-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.side-menu-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--sidebar-text);
}

.side-menu-close {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.side-menu-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.side-menu-nav {
    padding: 1rem 0;
}

.side-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.side-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.side-menu-item.active {
    background-color: var(--sidebar-active);
    color: var(--sidebar-text);
}

.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.side-menu-overlay.active {
    display: block;
    opacity: 1;
}
