/* ==== GLOBAL RESETS & DEFAULTS ==== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif; /* From your CSS */
    font-weight: 400; 
    margin: 0;
    padding: 0;
    padding-top: 55px; /* CRUCIAL: Space for the fixed top bar (match .top-bar height) */
    background-color: #e9ecef; 
    color: #343a40; 
    line-height: 1.6;
    font-size: 16px; 
}

a {
    color: #007bff; 
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}
a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* ==== TOP BAR (Copied from previous correct version) ==== */
.top-bar {
    background-color: #5D9CEC; 
    color: #ffffff;
    padding: 0 15px;          
    height: 55px;             
    display: flex;
    align-items: center;
    width: 100%;
    position: fixed;          
    top: 0;
    left: 0;
    z-index: 1030;            
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.top-bar-left { display: flex; align-items: center; flex-shrink: 0; margin-right: 15px; }
.top-bar-left .farm-logo { height: 35px; width: auto; margin-right: 10px; }
.top-bar-left .farm-name-link { text-decoration: none; color: #ffffff; display: flex; align-items: center; }
.top-bar-left .farm-name { font-size: 1.4em; font-weight: bold; white-space: nowrap; }
.top-bar-middle { flex-grow: 1; flex-shrink: 1; min-width: 100px; text-align: center; overflow: hidden; white-space: nowrap; padding: 5px 0; background-color: rgba(0, 0, 0, 0.07); border-radius: 4px; margin: 0 10px; }
.top-bar-middle .alert-ticker { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-bar-middle .alert-message { font-size: 0.85em; padding: 0 3px; opacity: 0.95; color: #ffffff; display: inline; }
.top-bar-middle .alert-message i.fa-bell { margin-right: 5px; color: #ffdd57; }
.top-bar-middle .alert-separator { opacity: 0.7; margin: 0 2px; display: inline; }
.top-bar-middle .no-alerts { font-size: 0.85em; opacity: 0.8; color: #e0e0e0; }
.top-bar-right { display: flex; align-items: center; flex-shrink: 0; margin-left: 15px; } /* Changed from margin-left: auto to ensure it doesn't get pushed out by a greedy middle if alerts are short */
.top-bar-right .user-profile-link { display: flex; align-items: center; text-decoration: none; color: #ffffff; padding: 5px 0; border-radius: 4px; transition: background-color 0.2s ease; }
.top-bar-right .user-profile-link:hover { background-color: rgba(255, 255, 255, 0.1); }
.top-bar-right .username-display { font-size: 0.9em; font-weight: 500; margin-right: 10px; white-space: nowrap; }
.top-bar-right .user-avatar-circle { background-color: #ffffff; color: #007bff; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 0.9em; cursor: pointer; flex-shrink: 0; }

/* User Menu Dropdown in Top Bar (from your style.css) */
.user-menu-container { position: relative; }
.user-menu-toggle { background-color: transparent; border: none; color: #ffffff; padding: 5px 8px; display: flex; align-items: center; cursor: pointer; border-radius: 4px; transition: background-color 0.2s ease; }
.user-menu-toggle:hover, .user-menu-toggle.active { background-color: rgba(255, 255, 255, 0.15); }
.user-menu-toggle .username-display { font-size: 0.9em; font-weight: 500; margin-right: 10px; }
.user-menu-toggle .user-avatar-circle { /* Already styled above, ensure consistency */ }
.user-menu-toggle .dropdown-arrow-user { margin-left: 8px; font-size: 0.8em; transition: transform 0.2s ease-in-out; }
.user-menu-toggle.active .dropdown-arrow-user { transform: rotate(180deg); }
.dropdown-menu.user-dropdown-menu { display: none; position: absolute; top: 100%; right: 0; background-color: #fff; min-width: 220px; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2); z-index: 1031; border-radius: 5px; margin-top: 5px; border: 1px solid #ddd; padding: 5px 0; }
.dropdown-menu.user-dropdown-menu.show { display: block; }
.user-dropdown-menu .dropdown-item { display: flex; align-items: center; padding: 10px 15px; text-decoration: none; color: #333; font-size: 0.9em; white-space: nowrap; }
.user-dropdown-menu .dropdown-item:hover { background-color: #f0f0f0; color: #0056b3; }
.user-dropdown-menu .dropdown-item i.fas { margin-right: 10px; width: 16px; text-align: center; color: #6c757d; }
.user-dropdown-menu .dropdown-item:hover i.fas { color: #0056b3; }
.user-dropdown-menu .dropdown-divider { height: 1px; margin: .5rem 0; overflow: hidden; background-color: #e9ecef; }
.top-bar-right .user-login-link { /* From your style.css, good */ color: #fff; border: 1px solid rgba(255,255,255,0.7); padding: 6px 12px; border-radius: 4px; font-size: 0.9em; text-decoration: none; transition: background-color 0.2s ease, border-color 0.2s ease; }
.top-bar-right .user-login-link:hover { background-color: rgba(255,255,255,0.15); border-color: #fff; }


/* ==== MAIN LAYOUT STRUCTURE (CRUCIAL) ==== */
.app-layout-container {
    display: flex;
    height: calc(100vh - 55px); /* Full viewport height minus top-bar height */
}

/* ==== SIDEBAR (Updated from your file, with collapsible parts) ==== */
.sidebar {
    width: 260px; 
    background-color: #253f59; /* From your style.css */
    height: 100%; 
    padding: 15px 10px 15px 15px; 
    box-sizing: border-box;
    overflow-y: auto;
    /* border-right: 1px solid #e0e0e0; /* Your file didn't have this, so omitted unless you want it */
    flex-shrink: 0;
    transition: width 0.3s ease; 
}
.sidebar h2 { 
    padding: 5px 10px 15px 10px; 
    margin: 0 0 15px 0; 
    color: #007bff; /* From your style.css */
    font-size: 1.3em; 
    border-bottom: 1px solid #e9ecef; 
    text-align: left; /* From your style.css */
    font-family: 'Inter', sans-serif; /* Consistent heading font */
    font-weight: 600;
}
.sidebar ul { list-style-type: none; padding: 0; margin: 0; }
.sidebar ul li { margin-bottom: 1px; }
.sidebar ul li a {
    display: flex; 
    align-items: center; 
    padding: 11px 15px; 
    text-decoration: none;
    color: #ffffff; /* From your style.css for sidebar links */
    border-radius: 5px; 
    font-size: 0.92rem; 
    font-family: 'Inter', sans-serif; /* Consistent font */
    font-weight: 500; 
    transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
    border-bottom: none; 
    position: relative; 
}
.sidebar ul li a .fas, .sidebar ul li a .far { 
    margin-right: 12px;
    font-size: 1em; 
    width: 20px; 
    text-align: center;
    color: #ffffff; /* From your style.css */
    transition: color 0.15s ease;
}
.sidebar ul li a:not(.active-main):hover {
    background-color: rgba(0, 123, 255, 0.07); /* From your style.css (light blue hover) */
    color: #ffffff; /* From your style.css */
    padding-left: 18px; 
}
.sidebar ul li a:not(.active-main):hover .fas, 
.sidebar ul li a:not(.active-main):hover .far,
.sidebar ul li a:not(.active-main):hover .submenu-arrow {
    color: #0056b3; /* This was in your style.css, but might look odd if link text remains white. Let's make it consistent with link hover */
    color: #ffffff; 
}
.sidebar ul li a.active-main { /* From your style.css */
    background-color: #007bff; 
    color: #ffffff;
    font-weight: 600;
}
.sidebar ul li a.active-main .fas, 
.sidebar ul li a.active-main .far,
.sidebar ul li a.active-main .submenu-arrow {
    color: #ffffff;
}
.sidebar ul li a .submenu-arrow { /* From your style.css */
    margin-left: auto; 
    font-size: 0.6em; 
    transition: transform 0.2s ease;
    color: #adb5bd; 
}
.sidebar ul li a.has-submenu.submenu-open .submenu-arrow { /* For JS collapsible */
    transform: rotate(90deg);
}
.sidebar ul .submenu { /* From your style.css + collapsible logic */
    padding-left: 0; 
    margin-left: 20px; 
    margin-top: 3px;
    margin-bottom: 5px; /* Was 8px in my suggestion, using yours */
    border-left: 3px solid #007bff; 
    background-color: transparent; 
    padding-top: 3px;
    padding-bottom: 3px;
    display: none; /* CRUCIAL for collapsible */
}
.sidebar ul .submenu.submenu-open { /* For JS collapsible */
    display: block;
}
.sidebar ul .submenu li a { /* From your style.css */
    padding: 9px 10px 9px 15px; 
    font-size: 0.88rem;
    color: #f8e110; /* Yellow text for submenu items from your style.css */
    font-weight: normal;
    border-radius: 4px; 
}
.sidebar ul .submenu li a .fas, 
.sidebar ul .submenu li a .far { /* From your style.css */
    margin-right: 10px;
    font-size: 0.9em;
    width: 18px;
    color: #adb5bd; 
}
.sidebar ul .submenu li a:not(.active-sub):hover { /* From your style.css */
    background-color: #e9ecef; 
    color: #0056b3;
}
.sidebar ul .submenu li a:not(.active-sub):hover .fas, 
.sidebar ul .submenu li a:not(.active-sub):hover .far {
    color: #0056b3;
}
.sidebar ul .submenu li a.active-sub { /* From your style.css */
    background-color: #cfe2ff; 
    color: #004085; 
    font-weight: 500; 
}
.sidebar ul .submenu li a.active-sub .fas, 
.sidebar ul .submenu li a.active-sub .far {
    color: #004085;
}
.soon-badge { /* From your style.css */
    font-size: 0.65em; background-color: #6c757d; color: #fff; padding: 2px 5px;
    border-radius: 10px; margin-left: 8px; vertical-align: middle;
    font-weight: normal; text-transform: uppercase;
}


/* ==== MAIN CONTENT AREA (Ensure these are correct) ==== */
.main-content {
    flex-grow: 1;
    padding: 25px;
    box-sizing: border-box;
    height: 100%; /* Fill height of .app-layout-container */
    overflow-y: auto;
    background-color: #e9ecef; /* Your preferred light grey background */
}
.main-content > h2:first-child { /* Main Page Titles */
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: #343a40;
    margin-top: 0;
    margin-bottom: 25px; /* More space after title */
    padding-bottom: 15px;
    border-bottom: 1px solid #ced4da;
    font-size: 1.8em;
}


/* ==== FORMS (Consolidated from your file and my suggestions) ==== */
.form-container { background-color: #fff; padding: 25px 30px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1); margin-bottom: 30px; }
.form-container > h2:first-child, .form-container > h3:first-child { text-align: left; margin-top:0; margin-bottom: 25px; color: #007bff; font-size: 1.5em; padding-bottom: 10px; border-bottom: 1px solid #eee; font-family: 'Inter', sans-serif; font-weight:600; }
.data-form .form-row { display: flex; flex-wrap: wrap; gap: 25px; margin-bottom: 18px; }
.data-form .form-group { flex: 1 1 calc(50% - 13px); display: flex; flex-direction: column; min-width: 220px; }
.data-form .form-group.full-width { flex-basis: 100%; }
.data-form label { margin-bottom: 6px; font-weight: 600; color: #495057; font-size: 0.9em; font-family: 'Inter', sans-serif; }
.data-form input[type="text"], .data-form input[type="date"], .data-form input[type="number"], .data-form input[type="password"], .data-form input[type="email"], .data-form select, .data-form textarea { padding: 10px 12px; border: 1px solid #ced4da; border-radius: 4px; box-sizing: border-box; width: 100%; font-size: 0.95em; font-family: 'Inter', sans-serif; background-color: #fff; transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
.data-form input:focus, .data-form select:focus, .data-form textarea:focus { border-color: #80bdff; outline: 0; box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); }
.data-form textarea { resize: vertical; min-height: 100px; }
.data-form small { font-size: 0.85em; color: #6c757d; margin-top: 5px; }
.field-error { color: #dc3545; font-size: 0.8em; display: block; margin-top: 4px; }


/* ==== BUTTONS (Consolidated) ==== */
.button, button.button { padding: 10px 18px; border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 0.95em; font-family: 'Inter', sans-serif; font-weight: 500; text-decoration: none; display: inline-block; text-align: center; vertical-align: middle; transition: all 0.2s ease-in-out; margin-right: 8px; margin-bottom: 8px; }
.button:last-of-type { margin-right: 0; }
.button.submit-button { background-color: #28a745; color: white; border-color: #28a745; }
.button.submit-button:hover { background-color: #218838; border-color: #1e7e34; }
.button.secondary-button { background-color: #6c757d; color: white; border-color: #6c757d; }
.button.secondary-button:hover { background-color: #5a6268; border-color: #545b62; }
.button.danger-button { background-color: #dc3545; color: white; border-color: #dc3545; }
.button.danger-button:hover { background-color: #c82333; border-color: #bd2130; }
.button.button-small { font-size: 0.8em; padding: 5px 10px; }
.action-link.submit-button { background-color: #28a745; }
 .action-link.submit-button:hover {background-color: #218838; }  
.action-link.view-link { background-color: #17a2b8; }
.action-link.view-link:hover { background-color: #138496; }

.action-link.edit-link { background-color: #ffc107; color: #212529 !important; }
.action-link.edit-link:hover { background-color: #e0a800; }    
.form-container .data-form .form-group.full-width .button,
.form-container .data-form .form-group.full-width button { width: auto; margin-top: 5px; margin-bottom: 5px; }


/* ==== MESSAGES (Consolidated) ==== */
.message { padding: 1rem; margin-bottom: 1.5rem; border: 1px solid transparent; border-radius: .25rem; text-align: left; font-size: 0.95em; }
.success-message { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; }
.error-message { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
.info-message { color: #055160; background-color: #cff4fc; border-color: #b6effb; }


/* ==== TABLES (Consolidated) ==== */
.table-responsive { width: 100%; overflow-x: auto; margin: 20px 0; border: 1px solid #dee2e6; border-radius: 5px; background-color: #fff; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.data-table th, .data-table td { border-bottom: 1px solid #dee2e6; border-right: 1px solid #dee2e6; padding: 10px 12px; text-align: left; vertical-align: middle; }
.data-table th:first-child, .data-table td:first-child { border-left: none; }
.data-table th:last-child, .data-table td:last-child { border-right: none; }
.data-table thead th { background-color: #e9ecef; font-weight: 600; color: #495057; border-bottom-width: 2px; border-top: none; }
.data-table tbody tr:hover { background-color: #f1f8ff; }
.data-table tfoot th { font-weight: bold; background-color: #e9ecef; }
.data-table.compact-table th, .data-table.compact-table td { padding: 8px 10px; }


/* ==== ACTION LINKS (in tables - Consolidated) ==== */
.action-link { display: inline-block; padding: 6px 10px; margin-right: 5px; margin-bottom: 5px; border-radius: 4px; text-decoration: none; font-size: 0.85em; border: none; color: white !important; text-align: center; }
.action-link:last-child { margin-right: 0; }
.view-link { background-color: #17a2b8; } .view-link:hover { background-color: #138496; }
.edit-link { background-color: #ffc107; color: #212529 !important; } .edit-link:hover { background-color: #e0a800; }
.delete-link, .cull-link { background-color: #dc3545; } .delete-link:hover, .cull-link:hover { background-color: #c82333; }
.transfer-link { background-color: #007bff; } .transfer-link:hover { background-color: #0069d9; }
.weight-link { background-color: #6c757d; } .weight-link:hover { background-color: #5a6268; }
.add-link { background-color: #28a745; } .add-link:hover { background-color: #218838; }


/* ==== PIG DETAILS PAGE (Consolidated from your file and my suggestions) ==== */
.profile-section { background-color: #ffffff; border: 1px solid #e0e0e0; border-radius: 6px; padding: 20px 25px; margin-bottom: 25px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.profile-section:last-child { margin-bottom: 0; }
.profile-section h3 { font-family: 'Inter', sans-serif; font-weight:600; color: #007bff; margin-top: 0; margin-bottom: 18px; padding-bottom: 8px; border-bottom: 2px solid #007bff; display: inline-block; font-size: 1.25em; }
.profile-section h3 .button-small.add-link { vertical-align: middle; margin-left: 10px; font-size: 0.75em !important; padding: 3px 8px !important; }
.definition-list { padding-left: 5px; }
.definition-list dt { font-weight: 600; color: #5a6268; font-size: 0.9em; margin-bottom: 3px; }
.definition-list dd { margin-left: 0; margin-bottom: 12px; color: #343a40; padding-left: 10px; border-left: 2px solid #e9ecef; font-size: 0.95em; }
.notes-display { background-color: #f8f9fa; padding: 15px; border-radius: 4px; border: 1px solid #dee2e6; white-space: pre-wrap; font-size: 0.95em; line-height: 1.5; margin-top:10px;}
.content-actions { margin-top: 20px; text-align: left; padding-top: 20px; border-top: 1px solid #eee; }
.content-actions .button { margin: 5px 10px 5px 0; }
/* Column layout for pig_details.php */
.details-column-container { display: flex; flex-direction: row; flex-wrap: wrap; gap: 25px; margin-bottom: 0; }
.details-column-container .profile-section.column-item { flex: 1 1 300px; min-width: 280px; margin-bottom: 25px; }
@media (max-width: 992px) { .details-column-container .profile-section.column-item { flex-basis: calc(50% - 13px); } }
@media (max-width: 680px) { .details-column-container { flex-direction: column; gap: 0; } }


/* ==== DASHBOARD STYLES (Consolidated from your file and my suggestions) ==== */
.dashboard-container > h2 { margin-bottom: 15px; }
.key-metrics-title { font-size: 1.25em; color: #495057; margin-top: 10px; margin-bottom: 15px; font-weight: 600; padding-bottom: 8px; border-bottom: 1px solid #dee2e6; }
.key-metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 20px; margin-bottom: 25px; }
/* UPDATED Metric Card Base Styling */
.metric-card {
    padding: 20px; /* Consistent padding */
    border-radius: 8px; /* Slightly more rounded corners */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* Enhanced shadow for depth */
    color: #ffffff; /* DEFAULT TEXT COLOR FOR CARDS - ASSUMING DARKER BACKGROUNDS */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Helps align title and trend if card height is fixed or similar */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    min-height: 130px; /* Ensure a minimum height for consistency */
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

.metric-card h4 { /* Title of the card, e.g., "Total Pigs" */
    margin-top: 0;
    margin-bottom: 10px; 
    font-size: 0.95em;   
    font-weight: 600; 
    opacity: 0.9; /* Slightly less prominent than the metric value */
    /* color: #f8f9fa; /* Will inherit from .metric-card or be set by specific card bg class */
}
.metric-card h4 i { /* Icons next to title */
    margin-right: 8px;
}

.metric-card .metric-value { /* The large number/value */
    font-size: 1.1em;    
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
    line-height: 1.1;
    /* color: #ffffff; /* Will inherit from .metric-card */
}

.metric-card .metric-trend { /* The small text like "Current herd size" */
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: auto; /* Pushes trend text to the bottom if card content varies */
    /* color: #e9ecef; /* Will inherit or be set by specific card bg class */
}
/* Remove specific arrow color classes if trend text is now just descriptive */
/* .metric-card .metric-trend .arrow-up { ... } */
/* .metric-card .metric-trend .arrow-down { ... } */


/* NEW: Softer / Lighter Background Colors for Metric Cards */
.metric-card.bg-green { background-color: #d4edda; color: #155724; }   /* Light green background, dark green text */
.metric-card.bg-blue { background-color: #dbe9ff; color: #0c4a8a; }    /* Soft light blue */
.metric-card.bg-purple { background-color: #ede2f7; color: #4b2175; }  /* Lavender */
.metric-card.bg-teal { background-color: #d3f2ed; color: #0f766e; }    /* Soft teal */
.metric-card.bg-red { background-color: #f8d7da; color: #721c24; }     /* Light red */
.metric-card.bg-orange { background-color: #ffe5d0; color: #9c4400; }  /* Peach / light orange */
.metric-card.bg-indigo { background-color: #e0d7f8; color: #3c1d8f; }  /* Light indigo */
.metric-card.bg-pink { background-color: #fce1ec; color: #a11057; }    /* Pastel pink */
.metric-card.bg-secondary { background-color: #f0f0f0; color: #343a40; } /* Light grey */

/* Optional: Light yellow background with dark text */
.metric-card.bg-yellow {
    background-color: #fff3cd;
    color: #856404;
}

.metric-card.bg-yellow h4,
.metric-card.bg-yellow .metric-trend {
    color: #564200;
}

/* Make sure text is dark for light backgrounds */
.metric-card.bg-green h4,
.metric-card.bg-blue h4,
.metric-card.bg-purple h4,
.metric-card.bg-teal h4,
.metric-card.bg-red h4,
.metric-card.bg-orange h4,
.metric-card.bg-indigo h4,
.metric-card.bg-pink h4,
.metric-card.bg-secondary h4 {
    color: inherit;
}

.metric-card.bg-green .metric-trend,
.metric-card.bg-blue .metric-trend,
.metric-card.bg-purple .metric-trend,
.metric-card.bg-teal .metric-trend,
.metric-card.bg-red .metric-trend,
.metric-card.bg-orange .metric-trend,
.metric-card.bg-indigo .metric-trend,
.metric-card.bg-pink .metric-trend,
.metric-card.bg-secondary .metric-trend {
    color: inherit;
    opacity: 0.8;
}


/* REMOVE OLD BORDER CLASSES if they only set border-top-color */
/* .metric-card.green-border { border-top-color: #28a745; } */
/* ... remove other .*-border classes ... */

.dashboard-alerts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 25px; }
.alert-card { background-color: #fff; padding: 18px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.07); }
.alert-card h4 { margin-top: 0; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 15px; font-size: 1.05em;}
.alert-card ul { list-style-type: none; padding-left: 0; margin-bottom:10px;}
.alert-card ul li { padding: 8px 0; border-bottom: 1px dotted #f0f0f0; font-size:0.9em; }
.alert-card ul li:last-child { border-bottom: none; }
.alert-card .view-all-link { display: block; text-align: right; margin-top: 15px; font-size: 0.9em; }
.upcoming-events h4 { color: #17a2b8; } .low-stock h4 { color: #ffc107; } 
.alert-card .metric-value { font-size:0.7em; text-align:center; font-weight: bold; color: #343a40; }
.quick-actions { margin-top: 20px; padding: 25px; background-color: #ffffff; border-radius: 6px; text-align:center; box-shadow: 0 2px 5px rgba(0,0,0,0.07); }
.quick-actions h4 { margin-top: 0; margin-bottom: 20px; font-size: 1.15em; color: #343a40; }
.quick-action-btn { margin: 8px; padding: 10px 18px; }
.quick-action-btn i { margin-right: 8px; }
.dashboard-divider { margin: 30px 0; border: 0; border-top: 1px solid #dee2e6;}

/* Report Page Specific Styles (Pig Summary, Financial Report etc.) */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 25px; margin-bottom: 25px; }
.report-card { /* This is often .profile-section reused */ }
.report-card h3 { /* Use .profile-section h3 styles or make specific */ font-size: 1.2em; color: #0056b3; margin-bottom: 15px; padding-bottom: 8px; border-bottom: 1px solid #ddd; }
.chart-container { width: 100%; max-width: 400px; height: 280px; margin: 0 auto 20px auto; }
.report-card .table-responsive { margin-top: 10px; border: 1px solid #eee; } /* Add border if card has no border */
.report-card .data-table.compact-table th, 
.report-card .data-table.compact-table td { padding: 7px 9px; font-size: 0.88em; }
.report-card .data-table tfoot th { font-size: 0.92em; }
.no-data-message { padding: 15px; text-align: center; color: #555; font-style: italic; }
.summary-table td { padding: 6px 10px; border-bottom: 1px solid #f0f0f0; } /* For financial summary table */
.summary-table tr:last-child td { border-bottom: none;}
.summary-table tr td:first-child { font-weight: 600; color: #444; width: 60%;}
.summary-table tr td:last-child { font-weight: bold; text-align: right; }
h3.report-period-title { font-size: 1.2em; color: #333; margin-bottom: 15px; text-align: left; border-bottom: 1px solid #ddd; padding-bottom: 8px; }
.financial-table { margin-bottom: 20px; }
.financial-table tfoot th { background-color: #f0f0f0; font-size: 1.05em; }
.financial-summary-total td { font-size: 1.2em; padding: 10px !important; background-color: #f8f9fa;}
.financial-summary-total td:first-child { font-weight: bold; }

/* Gallery Styles */
.pig-image-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin-top: 15px; }
.gallery-item { border: 1px solid #ddd; border-radius: 4px; padding: 10px; text-align: center; background-color: #f9f9f9; }
.gallery-item img { max-width: 100%; height: 120px; object-fit: cover; border-radius: 3px; margin-bottom: 8px; cursor: pointer; }
.gallery-item .primary-image-badge { display: block; font-size: 0.75em; font-weight: bold; color: #007bff; margin-bottom: 5px; }
.gallery-item .primary-image-badge i.fa-star { color: #ffc107; margin-right: 3px; }
.gallery-item .gallery-caption { font-size: 0.8em; color: #555; margin-top: 5px; min-height: 30px; overflow: hidden; text-align:left; }

/* Readonly input */
.readonly-input { background-color: #e9ecef; opacity: 0.9; cursor: not-allowed; }


/* ==== PRINT STYLES (Consolidated) ==== */
@media print {
    body { padding-top: 0 !important; font-size: 9pt; color: #000 !important; background-color: #fff !important; }
    .top-bar, .sidebar, .form-container.no-print, .form-container .data-form .form-group.full-width:last-child, /* Hide form buttons */
    .no-print, .action-buttons, .content-actions .button, .quick-actions,
    .dashboard-alerts-grid .view-all-link,
    .profile-section h3 a.add-link,
    .main-content > h2:first-child + div.form-container, /* Hides filter forms on top of reports */
    #reportOutputArea .button.no-print,
    .action-link /* Hide all action links in tables by default for print */
     { display: none !important; }

    .app-layout-container, .main-content, .container, .details-container, .pig-profile {
        display: block !important; height: auto !important; overflow: visible !important;
        width: 100% !important; margin: 0 !important; padding: 0 !important;
        background-color: #fff !important; box-shadow: none !important; border: none !important;
    }
    body * { visibility: hidden; background-color: transparent !important; color: #000 !important; box-shadow: none !important; text-shadow: none !important; }
    #reportOutputArea, #reportOutputArea *, /* For specific report printing */
    .main-content > h2:first-child, /* Ensure page title prints */
    .main-content .profile-section, .main-content .profile-section *, /* General details page sections */
    .main-content .table-responsive, .main-content .table-responsive * /* General table printing */
     { visibility: visible; }

    #reportOutputArea { position: static; margin: 15mm !important; padding: 0 !important; width: auto !important; }
    .main-content .profile-section, .report-card.profile-section {
        border: none !important; box-shadow: none !important; padding: 0 !important; margin-bottom: 15px !important;
        page-break-inside: avoid; /* Try to keep sections from breaking across pages */
    }
    .profile-section h3, .report-card h3, h3.report-period-title, h4.report-subtitle {
        border-bottom: 1px solid #333 !important; font-size: 1.1em !important;
        text-align: left !important; display: block !important;
    }
    .definition-list dt, .definition-list dd { border-left: none !important; padding-left: 0 !important; }
    .data-table, .data-table th, .data-table td { border: 1px solid #666 !important; border-collapse: collapse !important; padding: 4px !important; font-size: 0.85em !important; }
    .data-table th { background-color: #f0f0f0 !important; -webkit-print-color-adjust: exact; color-adjust: exact; font-weight: bold !important; }
    .data-table tr:nth-child(even) { background-color: transparent !important; }
    a { text-decoration: none !important; color: #000 !important; }
    a[href]:after { content: "" !important; }
    .table-responsive { overflow: visible !important; border: none !important; margin: 10px 0 !important;}
    .chart-container { display: none !important; } /* Hide charts when printing reports */
}
.action-link.disabled-link {
    background-color: #adb5bd !important; /* A distinct grey for disabled state */
    color: #6c757d !important;           /* Darker grey text for disabled */
    cursor: not-allowed !important;        /* Show "not allowed" cursor */
    opacity: 0.65;                         /* Make it appear faded */
    pointer-events: none; /* This CSS property fully disables click events,
                             the JS onclick="event.preventDefault(); return false;" is a fallback. */
}
.action-link.disabled-link:hover {
    background-color: #adb5bd !important; /* Keep same background on hover for disabled */
    color: #6c757d !important;           /* Keep same text color on hover */
}
}
.action-link.service-link:hover {
    background-color: #0056b3;
}