/* ===========================
   BASE STYLES
   =========================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8fafc;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 {
    color: #2d3748;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 24px;
}

h2 {
    color: #2d3748;
    font-size: 20px;
    font-weight: 600;
}

/* ===========================
   NAVIGATION
   =========================== */

.main-nav {
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 20px;
    padding: 8px 0;
    transition: opacity 0.2s;
}

.nav-brand:hover {
    opacity: 0.9;
}

.brand-icon {
    font-size: 28px;
    line-height: 1;
}

.brand-text {
    letter-spacing: 0.5px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-menu {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-icon {
    font-size: 18px;
    line-height: 1;
}

/* Mobile Navigation */
@media (max-width: 992px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
        flex-direction: column;
        gap: 0;
        padding: 20px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .nav-menu.active {
        max-height: 600px;
    }

    .nav-link {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        justify-content: flex-start;
    }

    .nav-icon {
        font-size: 20px;
    }
}

/* ===========================
   MAIN CONTENT & FOOTER
   =========================== */

.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
}

.main-footer {
    background: #2d3748;
    color: #a0aec0;
    padding: 24px 20px;
    margin-top: 60px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .main-content {
        padding: 30px 15px;
    }
}

/* ===========================
   LAYOUT
   =========================== */

.sidebyside {
    display: flex;
    gap: 20px;
}

.sidebyside > div {
    flex: 1;
    padding: 20px;
}

@media(max-width: 768px) {
    .sidebyside {
        flex-direction: column;
    }
}

/* ===========================
   CONTENT WRAPPERS
   =========================== */

.page-wrapper {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.section-header {
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

/* ===========================
   TABLES
   =========================== */

.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.modern-table {
    width: 100%;
    background: white;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table thead {
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    color: white;
}

.modern-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.modern-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
    color: #4a5568;
}

.modern-table tbody tr {
    transition: all 0.2s ease;
}

.modern-table tbody tr:hover {
    background-color: rgba(184, 197, 166, 0.1);
}

.modern-table tbody tr:last-child td {
    border-bottom: none;
}

/* Scrollable tables */
.scrollable-table {
    max-height: 500px;
    overflow-y: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.scrollable-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .modern-table {
        font-size: 12px;
    }

    .modern-table th,
    .modern-table td {
        padding: 12px 16px;
    }
}

/* ===========================
   STATUS BADGES
   =========================== */

.badge-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
}

.badge-status.active {
    background-color: rgba(156, 175, 136, 0.2);
    color: #6B8E4A;
}

.badge-status.pending {
    background-color: rgba(176, 125, 98, 0.2);
    color: #B07D62;
}

.badge-status.inactive,
.badge-status.bad {
    background-color: #fee;
    color: #c53030;
}

.badge-status.hatched {
    background-color: #e6ffed;
    color: #22863a;
}

.badge-status.available {
    background-color: rgba(34, 197, 94, 0.2);
    color: #16a34a;
}

.badge-status.feeding {
    background-color: rgba(251, 191, 36, 0.2);
    color: #d97706;
}

.badge-status.weight {
    background-color: rgba(59, 130, 246, 0.2);
    color: #2563eb;
}

.badge-status.health {
    background-color: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.badge-status.behavior {
    background-color: rgba(168, 85, 247, 0.2);
    color: #7c3aed;
}

/* Legacy support - will be phased out */
.status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    display: inline-block;
}

.status.active {
    background-color: rgba(156, 175, 136, 0.2);
    color: #6B8E4A;
}

.status.pending {
    background-color: rgba(176, 125, 98, 0.2);
    color: #B07D62;
}

.status.inactive {
    background-color: #fee;
    color: #c53030;
}

/* ===========================
   FORMS
   =========================== */

.form-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 24px;
    max-width: 500px;
}

.form-container h3 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #9CAF88;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

/* Filter elements */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
}

.filter-select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: #6B8E4A;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #9CAF88;
    background: #f7fafc;
}

.filter-btn.active {
    background: #6B8E4A;
    border-color: #6B8E4A;
    color: white;
}

/* ===========================
   BUTTONS
   =========================== */

.btn-primary {
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(156, 175, 136, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(156, 175, 136, 0.3);
}

.btn-secondary {
    background: white;
    color: #6B8E4A;
    padding: 12px 24px;
    border: 2px solid #6B8E4A;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: #f7fafc;
    transform: translateY(-1px);
}

.btn-danger {
    background: #fc8181;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #f56565;
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-tiny {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(156, 175, 136, 0.4);
}

.btn-large:hover {
    box-shadow: 0 6px 16px rgba(156, 175, 136, 0.5);
}

.btn-remove-tiny {
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-tiny:hover {
    background: #f56565;
}

/* ===========================
   STATS & CARDS
   =========================== */

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

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    text-align: center;
    border: 2px solid #e2e8f0;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.shipping-loss {
    border-left: 4px solid #fc8181;
}

.stat-card.alert {
    border-left: 4px solid #fc8181;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #a0aec0;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

.stat-value.net-revenue {
    color: #6B8E4A;
}

.shipping-loss .stat-value {
    color: #e53e3e;
}

.stat-detail {
    font-size: 12px;
    color: #a0aec0;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

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

.dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ===========================
   QUICK ACTIONS
   =========================== */

.quick-actions {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.quick-actions h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 16px 0;
}

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

.action-btn {
    display: block;
    padding: 16px;
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(156, 175, 136, 0.2);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(156, 175, 136, 0.3);
}

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

/* ===========================
   MODALS
   =========================== */

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

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-content h2 {
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    color: white;
    margin: 0;
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
}

.modal-content form {
    padding: 24px;
}

.close {
    color: white;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
}

.close:hover,
.close:focus {
    opacity: 0.8;
}

/* ===========================
   SPECIES SECTIONS
   =========================== */

.species-section {
    margin-bottom: 40px;
}

.species-header {
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 18px;
    font-weight: 600;
}

/* ===========================
   GECKO LINKS
   =========================== */

.gecko-id-link,
.gecko-link {
    color: #6B8E4A;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.gecko-id-link:hover,
.gecko-link:hover {
    color: #9CAF88;
    text-decoration: underline;
}

/* ===========================
   ADMIN PAGE
   =========================== */

/* Care category sections */
.care-category-section {
    margin-bottom: 30px;
}

.category-header {
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
}

/* Level badges */
.level-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.level-badge.cage {
    background-color: rgba(59, 130, 246, 0.2);
    color: #2563eb;
}

.level-badge.gecko {
    background-color: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.no-data {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 40px;
    background: #f8fafc;
    border-radius: 8px;
}

/* ===========================
   BREEDING GROUPS PAGE
   =========================== */

/* Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.group-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid #9CAF88;
}

.group-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.group-card.retired {
    opacity: 0.7;
    border-color: #cbd5e0;
    background: #f7fafc;
}

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

.group-id {
    font-size: 22px;
    font-weight: 700;
    color: #6B8E4A;
    margin: 0;
}

.group-actions {
    display: flex;
    gap: 8px;
}

.retired-badge {
    background: #cbd5e0;
    color: #4a5568;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.group-details {
    margin-bottom: 15px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.detail-label {
    color: #718096;
    font-weight: 600;
}

.detail-value {
    color: #2d3748;
}

.group-members {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.group-members h3 {
    font-size: 16px;
    color: #4a5568;
    margin-bottom: 10px;
}

.member-summary {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.sex-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.sex-badge.male {
    background: #bee3f8;
    color: #2c5282;
}

.sex-badge.female {
    background: #fed7d7;
    color: #742a2a;
}

.sex-badge.unknown {
    background: #e2e8f0;
    color: #4a5568;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f7fafc;
    border-radius: 6px;
    font-size: 13px;
}

.member-sex {
    color: #718096;
    font-size: 16px;
}

.no-members {
    color: #a0aec0;
    font-style: italic;
    font-size: 13px;
    padding: 8px 0;
}

.group-stats {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

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

/* ===========================
   CAGES PAGE
   =========================== */

.cages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 80px;
}

.cage-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.cage-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px -2px rgba(156, 175, 136, 0.2);
}

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

.cage-id {
    margin: 0;
    color: #2d3748;
    font-size: 24px;
    font-weight: 700;
}

.cage-actions {
    display: flex;
    gap: 8px;
}

/* Condensed cage details - side by side */
.cage-details-condensed {
    margin-bottom: 20px;
}

.detail-row-inline {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.detail-item {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
}

/* Recent Feedings Section */
.cage-feedings {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.cage-feedings h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feeding-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feeding-item {
    background: #f8fafc;
    border-radius: 6px;
    padding: 8px 12px;
    border-left: 3px solid #6B8E4A;
}

.feeding-time {
    font-size: 12px;
    color: #6B8E4A;
    font-weight: 600;
    margin-bottom: 2px;
}

.feeding-details {
    font-size: 13px;
    color: #2d3748;
}

.food-type {
    font-weight: 500;
}

.feeding-notes {
    color: #718096;
    font-style: italic;
}

.no-feedings {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 12px;
    font-size: 14px;
    background: #f8fafc;
    border-radius: 6px;
}

/* Enhanced inhabitants section */
.cage-inhabitants,
.cage-environment {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.cage-inhabitants h3,
.cage-environment h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inhabitant-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 6px;
}

.inhabitant-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.species-name {
    font-size: 13px;
    color: #2d3748;
    font-weight: 500;
}

.gecko-ids {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inhabitant-details {
    font-size: 13px;
    color: #6B8E4A;
    font-weight: 600;
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.total-count {
    margin-top: 8px;
    font-size: 12px;
    color: #718096;
    text-align: right;
    font-weight: 600;
}

.no-inhabitants {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 12px;
    font-size: 14px;
}

.env-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.env-section {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px;
}

.env-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-align: center;
}

.env-readings {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.env-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px;
}

.env-icon {
    font-size: 16px;
}

.env-value {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
}

.env-time {
    font-size: 11px;
    color: #a0aec0;
    margin-bottom: 8px;
}

.env-link {
    display: inline-block;
    font-size: 12px;
    color: #6B8E4A;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.env-link:hover {
    color: #9CAF88;
}

@media (max-width: 768px) {
    .cages-grid {
        grid-template-columns: 1fr;
    }
    
    .env-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-row-inline {
        flex-direction: column;
        gap: 8px;
    }
}

/* ===========================
   CARE PAGE (CALENDAR)
   =========================== */

/* Calendar Styles */
.calendar-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 20px 0;
}

.calendar-week {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.week-label {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 8px;
    min-height: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    border-color: #9CAF88;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(156, 175, 136, 0.2);
}

.calendar-day.today {
    border-color: #6B8E4A;
    background: rgba(156, 175, 136, 0.05);
    border-width: 3px;
}

.calendar-day.has-events {
    background: rgba(156, 175, 136, 0.08);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.day-name {
    font-size: 11px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
}

.day-number {
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
}

.feeding-summary {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feed-icon {
    font-size: 16px;
    margin-bottom: 4px;
}

.species-feed {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 12px;
}

.species-initials {
    font-weight: 600;
    color: #6B8E4A;
}

.other-events-indicator {
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px solid #e2e8f0;
    font-size: 10px;
    color: #a0aec0;
    text-align: center;
}

.no-events {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e0;
    font-size: 24px;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 12px;
    color: #4a5568;
    margin-top: 16px;
}

.event-count {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

@media (max-width: 1200px) {
    .calendar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .calendar-day {
        min-height: 100px;
        padding: 8px 6px;
    }
}

/* ===========================
   DASHBOARD PAGE
   =========================== */

/* Feeding Status Grid */
.feeding-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.feeding-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 3px solid;
    transition: all 0.2s ease;
}

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

.feeding-card.status-good {
    border-color: #6B8E4A;
    background: rgba(107, 142, 74, 0.05);
}

.feeding-card.status-warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.feeding-card.status-urgent {
    border-color: #e53e3e;
    background: rgba(229, 62, 62, 0.05);
}

.feeding-card.status-none {
    border-color: #cbd5e0;
    background: #f8fafc;
}

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

.status-indicator {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 12px;
}

.status-good .status-indicator {
    background: #6B8E4A;
    color: white;
}

.status-warning .status-indicator {
    background: #f59e0b;
    color: white;
}

.status-urgent .status-indicator {
    background: #e53e3e;
    color: white;
}

.status-none .status-indicator {
    background: #cbd5e0;
    color: #4a5568;
}

.inhabitants-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.species-tag {
    font-size: 12px;
    background: rgba(156, 175, 136, 0.2);
    color: #6B8E4A;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

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

/* ===========================
   GECKO DETAIL PAGE
   =========================== */

.gecko-header-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.gecko-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 2px solid #e2e8f0;
}

.gecko-header-content h1 {
    margin: 0 0 8px 0;
    color: #2d3748;
    font-size: 32px;
}

.gecko-species {
    color: #718096;
    font-size: 18px;
    font-style: italic;
    margin: 0;
}

.gecko-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

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

.info-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #a0aec0;
}

.info-value {
    font-size: 16px;
    color: #2d3748;
    font-weight: 500;
}

.chart-container {
    height: 300px;
    padding: 20px;
}

/* ===========================
   ENVIRONMENT PAGE
   =========================== */

.environment-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 95%;
    margin: 0 auto;
}

.cage-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-width: none;
    width: 100%;
}

.cage-title {
    margin: 0 0 20px 0;
    color: #2d3748;
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.cage-content {
    display: flex;
    gap: 24px;
    margin-top: 20px;
}

@media (max-width: 1024px) {
    .cage-content {
        flex-direction: column;
    }
}

.chart-wrapper {
    flex: 1;
    min-width: 0;
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.chart-wrapper h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #2d3748;
    font-weight: 600;
}

.chart-wrapper canvas {
    min-height: 300px !important;   /* Ensure readability on small screens */
    max-height: 600px !important;   /* Prevent overwhelming on large screens */
    height: 35vh !important;        /* Responsive between the limits */
    width: 100% !important;
}

.scrollable-table {
    flex: 1;
    min-width: 0;
    max-height: 500px;
    overflow-y: auto;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.scrollable-table .modern-table {
    box-shadow: none;
    border-radius: 0;
}

.scrollable-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Right panel for summary and data */
.env-right-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Ensure chart wrapper takes exactly half width */
.cage-content .chart-wrapper {
    flex: 1;
    min-width: 0;
    max-width: 50%;
}

/* Ensure right panel takes exactly half width */
.cage-content .env-right-panel {
    flex: 1;
    min-width: 0;
    max-width: 50%;
}

/* Summary section styling */
.summary-section {
    background: #f0f4ff;
    border-radius: 8px;
    border: 2px solid #cbd5e0;
    padding: 16px;
}

.summary-header {
    margin-bottom: 12px;
}

.summary-header h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    color: #2d3748;
    font-weight: 600;
}

.summary-note {
    text-align: center;
    color: #64748b;
    font-style: italic;
    margin: 0;
}

/* Summary table specific styling */
.summary-table {
    font-size: 11px;
    margin-top: 8px;
}

.summary-table th {
    padding: 6px 4px;
    font-size: 10px;
    text-align: center;
}

.summary-table td {
    padding: 6px 4px;
    text-align: center;
    font-size: 10px;
}

.summary-table th[rowspan] {
    vertical-align: middle;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    width: 80px;
}

/* Responsive adjustments for environment page */
@media (max-width: 1200px) {
    .cage-content {
        flex-direction: column;
    }
    
    /* Reset max-widths when stacking vertically */
    .cage-content .chart-wrapper,
    .cage-content .env-right-panel {
        max-width: none;
    }
    
    .env-right-panel {
        flex-direction: row;
        gap: 20px;
    }
    
    .summary-section {
        flex: 1;
        min-width: 300px;
    }
    
    .scrollable-table {
        flex: 1;
        min-width: 400px;
    }
}

@media (max-width: 768px) {
    .environment-container {
        max-width: 100%;
    }
    
    .env-right-panel {
        flex-direction: column;
    }
    
    .summary-table {
        font-size: 9px;
    }
    
    .summary-table th,
    .summary-table td {
        padding: 4px 2px;
        font-size: 8px;
    }
    
    .summary-table th[rowspan] {
        writing-mode: horizontal-tb;
        text-orientation: initial;
        width: auto;
        padding: 8px 4px;
    }
}

/* ===========================
   SALES PAGE
   =========================== */

.gecko-checkbox-item {
    margin: 2px 0;
}

.gecko-checkbox-item label:hover {
    background: #e2e8f0;
}

.gecko-checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.analytics-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.analytics-card h2 {
    font-size: 18px;
    color: #4a5568;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

/* Breakdown Table */
.breakdown-table {
    width: 100%;
    font-size: 14px;
}

.breakdown-table th {
    text-align: left;
    padding: 8px;
    color: #718096;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.breakdown-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f7fafc;
}

.breakdown-table tr:hover {
    background: #f7fafc;
}

/* Trend Chart */
.trend-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trend-bar {
    display: grid;
    grid-template-columns: 80px 1fr 70px;
    align-items: center;
    gap: 10px;
}

.trend-month {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
}

.trend-visual {
    background: #e2e8f0;
    border-radius: 4px;
    height: 24px;
    position: relative;
    overflow: hidden;
}

.trend-bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    transition: width 0.3s ease;
    min-width: 50px;
}

.trend-value {
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.trend-count {
    font-size: 12px;
    color: #718096;
    text-align: right;
}

/* Sales Table */
.sales-table-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sales-table-container h2 {
    font-size: 20px;
    color: #2d3748;
    margin-bottom: 20px;
}

.table-wrapper {
    overflow-x: auto;
}

.price {
    text-align: right;
    font-weight: 600;
    color: #6B8E4A;
}

.shipping-loss-cell {
    color: #e53e3e !important;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .trend-bar {
        grid-template-columns: 60px 1fr 60px;
        gap: 6px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   LOGIN PAGE
   =========================== */

body.login-page {
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.login-container h1 {
    color: #2d3748;
    font-size: 28px;
    margin-bottom: 12px;
    font-weight: 700;
}

.subtitle {
    color: #718096;
    font-size: 14px;
    margin-bottom: 32px;
}

.error-message {
    background-color: #fee;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #feb2b2;
}

.login-container .form-group {
    margin-bottom: 24px;
    text-align: left;
}

.login-container .form-group label {
    display: block;
    color: #4a5568;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-container .form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background-color: #f8fafc;
}

.login-container .form-group input:focus {
    outline: none;
    border-color: #9CAF88;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(156, 175, 136, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #9CAF88 0%, #B8C5A6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(156, 175, 136, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(156, 175, 136, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.footer-text {
    margin-top: 32px;
    color: #a0aec0;
    font-size: 12px;
}

@media (max-width: 480px) {
    .login-container {
        padding: 32px 24px;
    }

    .login-container h1 {
        font-size: 24px;
    }
}

/* Flash Messages */
.flash-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
}

.flash-message ul {
    margin: 0;
    padding-left: 20px;
}

.flash-success {
    background-color: #def7ec;
    color: #03543f;
    border: 1px solid #84e1bc;
}

.flash-error {
    background-color: #fee;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.flash-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.flash-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Auth Links */
.auth-links {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.auth-links p {
    margin: 8px 0;
    color: #718096;
    font-size: 14px;
}

.auth-links a {
    color: #9CAF88;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-links a:hover {
    color: #7d9570;
    text-decoration: underline;
}

/* Form Helper Text */
.login-container .form-group small {
    display: block;
    color: #a0aec0;
    font-size: 12px;
    margin-top: 4px;
}

/* Error Message List Styles */
.error-message ul {
    list-style-position: inside;
    text-align: left;
    margin: 0;
    padding: 0;
}

.error-message li {
    margin: 4px 0;
}

/* ===========================
   UTILITY CLASSES
   =========================== */

#selected-eggs-list {
    color: #4a5568;
    font-size: 14px;
}