/* Custom styles to complement Bootstrap (modernized) */

:root {
    /* Primary Colors */
    --primary: #6AB86A;
    --primary-light: #7CC27C;
    --primary-dark: #3A8A3A;

    /* Accent Colors */
    --accent: #FF9B6B;
    --accent-light: #FFB599;

    /* Neutral Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9F9F9;
    --bg-tertiary: #F0F0F0;
    --text-primary: #2C2C2C;
    --text-secondary: #666666;
    --border-color: #E0E0E0;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #F5F5F5 0%, #FAFAFA 100%);
    min-height: 100vh;
}

/* Make Bootstrap containers use full browser width */
.container {
    max-width: 100% !important;
    padding-left: clamp(1rem, 3vw, 2.5rem) !important;
    padding-right: clamp(1rem, 3vw, 2.5rem) !important;
}

/* Rounded images by default */
img {
    border-radius: var(--radius-lg);
    max-width: 100%;
    height: auto;
}

/* Extra rounding for animal photos (overrides Bootstrap `.rounded` / `.img-thumbnail`) */
img[src^="/animal-image/"] {
    border-radius: var(--radius-xl) !important;
}

/* Navbar customizations */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.navbar-left {
    min-width: 1px;
    justify-self: start;
    display: flex;
    align-items: center;
}

.navbar-brand-center {
    justify-self: center;
}

.navbar-right {
    justify-self: end;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.4rem;
    color: white !important;
    transition: var(--transition);
}

.navbar-brand:hover {
    transform: translateY(-2px);
}

.nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin: 0 0.25rem;
    padding: 0.5rem 0.75rem !important;
    transition: var(--transition);
}

.nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Navbar user */
.navbar-user-name {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 600;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-toggle {
    color: white !important;
    border: 0;
    background: rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-lg);
    padding: 0.45rem 0.6rem;
    line-height: 1;
    transition: var(--transition);
}

.user-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.user-menu-toggle:focus,
.user-menu-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
}

/* Hamburger (offcanvas) button */
.navbar-toggler {
    border: 0;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.10);
    transition: var(--transition);
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.navbar-toggler:focus,
.navbar-toggler:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
}

/* Offcanvas navigation */
.offcanvas {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
}

.offcanvas .offcanvas-header {
    border-bottom: 1px solid var(--border-color);
}

.offcanvas .offcanvas-title {
    font-weight: 700;
    color: var(--text-primary);
}

.offcanvas-nav .nav-link {
    color: var(--text-primary) !important;
    border-radius: var(--radius-lg);
    padding: 0.75rem 0.9rem !important;
    margin: 0.15rem 0;
}

.offcanvas-nav .nav-link:hover {
    background: var(--bg-secondary);
    color: var(--primary) !important;
}

.offcanvas-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 0.9rem 0.25rem;
}

/* Admin dropdown inside offcanvas */
.offcanvas-admin-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.offcanvas-admin-toggle[aria-expanded="true"] {
    background: var(--bg-secondary);
}

.offcanvas-admin-chevron {
    transition: transform 0.2s ease;
}

.offcanvas-admin-toggle[aria-expanded="true"] .offcanvas-admin-chevron {
    transform: rotate(180deg);
}

.offcanvas-subnav {
    margin-left: 0.25rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border-color);
}

.offcanvas-subnav .nav-link {
    padding-left: 0.85rem !important;
}

.dropdown-menu {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--bg-secondary);
    color: var(--primary);
}

.navbar-logo {
    height: 35px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
}

/* Ensure dropdowns work properly on mobile */
.navbar-collapse {
    margin-top: 1rem;
}

@media (min-width: 992px) {
    .navbar-collapse {
        margin-top: 0;
    }
}

.lang-switcher {
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.lang-switcher a {
    color: white;
    text-decoration: none;
}

/* Main content area */
main {
    margin-top: 2rem;
    margin-bottom: 2rem;
    min-height: calc(100vh - 200px);
}

@media (max-width: 768px) {
    main {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
}

/* Cards & modals (Bootstrap components) */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    background: var(--bg-primary);
    overflow: hidden;
}

.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* Subscription card: collapsed summary, expand shows dates on one line */
.subscription-details summary {
    list-style: none;
    cursor: pointer;
}
.subscription-details summary::-webkit-details-marker,
.subscription-details summary::marker {
    display: none;
}
.subscription-details .subscription-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.subscription-details[open] .subscription-chevron {
    transform: rotate(180deg);
}
.subscription-details .subscription-dates {
    white-space: nowrap;
}

.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.modal-header,
.modal-footer {
    border-color: var(--border-color);
}

.intro-section {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .intro-section {
        padding: 1.5rem;
    }
}

.homepage-logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.homepage-logo {
    max-width: 400px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.homepage-pets-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.intro-section h1 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 2rem;
    text-align: center;
}

.intro-content {
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
    color: var(--text-secondary);
}

.intro-content p {
    margin-bottom: 1.2rem;
    text-align: justify;
    font-size: 1rem;
}

.intro-content p:first-of-type {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.generator {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.generator h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.filters {
    margin-bottom: 2rem;
}

.filters h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.range-inputs input {
    width: 100px;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    text-align: center;
}

.range-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.5rem 0;
}

.filter-group input[type="text"] {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

.filter-group select {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem;
    padding-right: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
    cursor: pointer;
    transition: var(--transition);
}

.filter-group select:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(106, 184, 106, 0.18);
}

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

/* Styled inputs (Bootstrap + plain inputs) */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: var(--transition);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(106, 184, 106, 0.18);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Styled select dropdowns for animal type and breed */
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
    cursor: pointer;
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(106, 184, 106, 0.18);
}

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

/* Clickable table rows */
.animal-table-row {
    transition: background-color 0.2s ease;
}

.animal-table-row:hover {
    background-color: #f8f9fa !important;
}

.animal-table-row td {
    user-select: none;
}

.system-selection {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.system-selection h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.filter-group > div[style*="display: flex"] {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    max-width: 400px;
}

.filter-group > div[style*="display: flex"] input[type="text"] {
    max-width: none;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    display: inline-block;
    background-color: #adb5bd !important;
    border-color: #adb5bd !important;
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
    min-width: auto;
    height: auto;
}

.btn-secondary:hover {
    background-color: #9ca3af !important;
    border-color: #8a9199 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.results {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #eee;
}

.results-row {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.result-group {
    flex: 1;
    min-width: 200px;
}

.results h3 {
    margin-bottom: 1rem;
    color: #6AB86A;
}

.number-display {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.number-badge {
    background: linear-gradient(135deg, #6AB86A 0%, #3A8A3A 100%);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.star-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.auth-page {
    max-width: 400px;
    margin: 2rem auto;
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

@media (max-width: 576px) {
    .auth-page {
        margin: 1rem;
        padding: 1.5rem;
    }
}

/* Animal weight: make chart range buttons responsive on mobile */
@media (max-width: 576px) {
    .weight-chart-header {
        align-items: stretch;
    }

    .weight-range-group {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Undo Bootstrap btn-group "joined buttons" on wrap */
    .weight-range-group > .btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 0;
        border-radius: var(--radius-md) !important;
    }

    .weight-range-group > .btn:not(:first-child) {
        margin-left: 0 !important;
    }
}

/* Animal weight: make table more usable on small screens */
@media (max-width: 576px) {
    /* Hide notes column to make actions easier to tap */
    .weight-notes-col {
        display: none;
    }
}

/* Animal weight: action icons should not have borders */
.weight-actions .btn {
    border: none !important;
}

/* Animal detail: mobile-friendly tables (hide low-priority columns) */
@media (max-width: 768px) {
    /* Events: hide type and description so actions stay visible */
    .animal-detail-page .ad-events-type-col,
    .animal-detail-page .ad-events-desc-col {
        display: none !important;
    }

    /* Diary: hide title column in mobile mode */
    .animal-detail-page .ad-diary-title-col {
        display: none !important;
    }
    
    /* Diary: shorten content column in mobile mode */
    .animal-detail-page .ad-diary-content-col {
        max-width: 100px !important;
    }

    /* Vaccinations: hide expiration date */
    .animal-detail-page .ad-vacc-expiry-col {
        display: none !important;
    }

    /* Documents: hide file + uploaded columns */
    .animal-detail-page .ad-doc-file-col,
    .animal-detail-page .ad-doc-uploaded-col {
        display: none !important;
    }
    
    /* Documents: shorten name column in mobile mode */
    .animal-detail-page .ad-doc-name-col {
        max-width: 100px !important;
    }

    /* Ensure "hover expand" never triggers in mobile layout */
    .animal-detail-page .text-truncate-cell:hover {
        white-space: nowrap !important;
        word-wrap: normal !important;
        overflow: hidden !important;
        position: static !important;
        z-index: auto !important;
        background-color: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        border-radius: 0 !important;
        max-width: 100% !important;
    }
}

/* Mobile/desktop element visibility classes no longer needed for diary/documents */
/* They now use the same approach as events table (direct text-truncate-cell on td) */

.auth-page h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1.05rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    resize: vertical;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(106, 184, 106, 0.18);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Checkboxes (plain + Bootstrap) */
input[type="checkbox"]:not(.form-check-input) {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    border-radius: 0.35rem;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
}

.form-check-input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.35rem;
    vertical-align: middle;
}

/* Bootstrap switch (slider) sizing */
.form-check.form-switch .form-check-input[type="checkbox"] {
    /* Keep Bootstrap switch shape, just make it larger */
    transform: scale(1.25);
    transform-origin: left center;
    border-radius: 999px;
}

.form-check.form-switch .form-check-input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:not(.form-check-input):focus-visible,
.form-check-input[type="checkbox"]:focus,
.form-check-input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(106, 184, 106, 0.18);
}

.auth-link {
    margin-top: 1rem;
    text-align: center;
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
}

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

.my-pages {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .my-pages {
        padding: 1rem;
    }
}

/* My Pages: hide breed column on mobile in "My animals" list */
@media (max-width: 768px) {
    .my-pages .animals-table .my-animals-breed-col {
        display: none;
    }
}

/* My Pages: make "My animals" list a bit narrower on mobile */
@media (max-width: 768px) {
    .my-pages .animals-table th,
    .my-pages .animals-table td {
        padding: 6px !important; /* override inline padding */
    }

    .my-pages .animals-table th:first-child,
    .my-pages .animals-table td:first-child {
        width: 60px !important; /* override inline 80px */
    }

    .my-pages .animal-list-avatar {
        width: 40px !important;
        height: 40px !important;
    }
}

@media (max-width: 576px) {
    .my-pages {
        padding: 0.75rem;
    }
}

.my-pages h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.user-info {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.user-info p {
    margin-bottom: 0.5rem;
}

.profile-form {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.profile-form h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Table section icons (Font Awesome 6 free, local SVGs – regular/outline where available) */
.animal-detail-page .card-header h3 .table-section-icon {
    width: 1.25em;
    height: 1.25em;
    margin-right: 0.5em;
    vertical-align: -0.2em;
    color: inherit;
}

.mfa-form {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.mfa-form h3 {
    margin-bottom: 1rem;
    color: #555;
}

.readonly-field {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.875rem;
    font-style: italic;
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    resize: vertical;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    border: none;
    box-shadow: var(--shadow-sm);
}

.alert-danger {
    background-color: #FFEBEE;
    color: #C62828;
    border-left: 4px solid #EF5350;
}

.alert-success {
    background-color: #E8F5E9;
    color: #2E7D32;
    border-left: 4px solid #4CAF50;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab-button {
    background: none;
    border: 1px solid #ddd;
    border-bottom: 3px solid transparent;
    padding: 1rem 2rem;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
    font-weight: 500;
    border-radius: 8px 8px 0 0;
    margin-right: 0.25rem;
}

.tab-button:hover {
    color: #6AB86A;
    background-color: #f5f5f5;
    border-color: #ddd;
}

.tab-button.active {
    color: #6AB86A;
    border-color: #ddd;
    border-bottom-color: #6AB86A;
    background-color: #f9f9f9;
}

/* Bootstrap 5 handles tab-content visibility automatically, no custom CSS needed */

@media (max-width: 576px) {
    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

.password-form {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.password-form h3 {
    margin-bottom: 1rem;
    color: #555;
}

/* Top button */
.top-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6AB86A 0%, #3A8A3A 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.top-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #3A8A3A 0%, #6AB86A 100%);
}

.top-button:active {
    transform: translateY(-1px);
}

@media (max-width: 576px) {
    .top-button {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* Cookie Consent Popup */
.cookie-consent-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    z-index: 10000;
    padding: 1.5rem;
    border-top: 3px solid var(--primary);
}

.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.cookie-consent-content h3 {
    color: var(--primary);
    margin: 0;
    font-size: 1.25rem;
}

.cookie-consent-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.cookie-consent-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.cookie-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.cookie-btn-necessary {
    background: var(--bg-primary);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.cookie-btn-necessary:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.cookie-btn-accept {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.cookie-btn-accept:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Text truncation for table cells */
.text-truncate-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

/* Only expand truncated text on devices that actually support hover (desktop/laptop). */
@media (hover: hover) and (pointer: fine) {
    .text-truncate-cell:hover {
        white-space: normal;
        word-wrap: break-word;
        overflow: visible;
        position: relative;
        z-index: 10;
        background-color: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        padding: 0.5rem;
        border-radius: 4px;
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .text-truncate-cell {
        max-width: 150px;
    }
}

/* Clickable table rows */
.table tbody tr[onclick] {
    transition: background-color 0.2s ease;
}

.table tbody tr[onclick]:hover {
    background-color: #f8f9fa !important;
}

.table tbody tr[onclick] td {
    user-select: none;
}

/* Ensure icons are always visible in action buttons */
.table .btn-sm {
    min-width: 32px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Action buttons in tables */
.table .d-flex.gap-1 .btn {
    min-width: 38px;
    padding: 0.25rem 0.5rem;
}

/* Unified button base styles - all buttons should have same size and rounding */
.btn:not(.btn-sm):not(.btn-lg):not(.btn-xl) {
    padding: 0.5rem 1rem !important;
    font-size: 1rem;
    border-radius: var(--radius-lg) !important;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    line-height: 1.5;
    transition: var(--transition);
}

.btn:focus,
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(106, 184, 106, 0.18);
}

/* Override Bootstrap default border-radius */
.btn-primary,
.btn-danger,
.btn-outline-danger,
.btn-success,
.btn-warning,
.btn-info,
.btn-light,
.btn-dark,
.btn-weight {
    border-radius: var(--radius-lg) !important;
    transition: var(--transition);
}

/* Primary buttons - consistent light green gradient styling */
.btn-primary:not(.btn-sm) {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
}

.btn-primary:not(.btn-sm):hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-dark) 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Icon buttons with transparent background and no border */
.btn-sm.btn-primary {
    background: transparent !important;
    border: none !important;
    color: var(--primary);
    border-radius: var(--radius-lg);
    padding: 0.25rem 0.5rem;
}

.btn-sm.btn-primary:hover {
    background: rgba(106, 184, 106, 0.1) !important;
    border: none !important;
    color: var(--primary);
}

/* Delete buttons - default red background for full-size buttons */
.btn-danger:not(.btn-sm) {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    min-height: 38px;
}

.btn-danger:not(.btn-sm):hover {
    background-color: #c82333;
    border-color: #bd2130;
    color: white;
}

/* Icon delete buttons (btn-sm) with transparent background and no border */
.btn-sm.btn-danger {
    background: transparent !important;
    border: none !important;
    color: #dc3545;
    border-radius: var(--radius-lg);
    padding: 0.25rem 0.5rem;
}

.btn-sm.btn-danger:hover {
    background: rgba(220, 53, 69, 0.1) !important;
    border: none !important;
    color: #dc3545;
}

.btn-danger:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5);
}

/* Secondary buttons - neutral gray color for cancel/close buttons */
.btn-secondary:not(.btn-sm) {
    background-color: #adb5bd !important;
    border-color: #adb5bd !important;
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    min-height: 38px;
    transition: var(--transition);
}

.btn-secondary:not(.btn-sm):hover {
    background-color: #9ca3af !important;
    border-color: #8a9199 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Outline buttons (used on search pages: "Visa", etc.) */
.btn-outline-primary {
    border: 2px solid var(--primary) !important;
    color: var(--primary) !important;
    background: transparent !important;
}

.btn-outline-primary:hover {
    background: rgba(106, 184, 106, 0.12) !important;
    color: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Search results list -> card-like items with spacing */
.list-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.list-group-item {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    color: inherit;
    text-decoration: none;
}

.list-group-item:focus,
.list-group-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 155, 107, 0.25), var(--shadow-sm);
}

.list-group-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Highlight element when arriving from search */
.search-focus {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

tr.search-focus td {
    background-color: rgba(255, 155, 107, 0.16) !important;
}

/* Calendar highlight (booking focus) */
#calendar-container td.calendar-highlight {
    box-shadow: 0 0 0 3px rgba(255, 155, 107, 0.22);
}

/* Badges (search result type chips etc.) */
.badge {
    border-radius: var(--radius-md);
    font-weight: 600;
    padding: 0.35rem 0.7rem;
}

/* Ensure modal footer buttons are consistent */
.modal-footer .btn {
    min-width: auto;
    margin: 0 0.25rem;
}

/* Align calendar with animal info card (not the h2 header) */
.calendar-spacer {
    height: 0;
    visibility: hidden;
}

@media (min-width: 992px) {
    /* Match the height of h2.mb-4 to align calendar with the card below */
    /* Added extra margin to push calendar slightly down */
    .calendar-spacer {
        height: calc(1.5rem + 1.5rem + 0.5rem); /* h2 line-height + mb-4 margin-bottom + extra spacing */
        visibility: visible;
    }
}

/* Calendar styles */
#calendar-container table {
    width: 100%;
}

#calendar-container td {
    vertical-align: top;
    min-height: 60px;
}

#calendar-container td:hover {
    background-color: #f0f0f0 !important;
}

#calendar-container .badge {
    display: block;
    margin: 0.1rem 0;
    font-size: 0.65rem;
}

/* Sticky calendar on desktop */
@media (min-width: 992px) {
    .sticky-top {
        position: sticky;
    }
}

/* Responsive design for cookie consent */
@media (max-width: 768px) {
    .cookie-consent-popup {
        padding: 1rem;
    }
    
    .cookie-consent-content {
        gap: 0.75rem;
    }
    
    .cookie-consent-content h3 {
        font-size: 1.1rem;
    }
    
    .cookie-consent-content p {
        font-size: 0.95rem;
    }
    
    .cookie-consent-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .cookie-btn {
        width: 100%;
    }
    
    /* Calendar on mobile */
    #calendar-container {
        font-size: 0.8rem;
    }
    
    #calendar-container td {
        padding: 0.25rem !important;
        min-height: 50px;
    }
}

/* Override Bootstrap primary color to light green */
.bg-primary {
    background-color: #6AB86A !important;
    background: linear-gradient(135deg, #6AB86A 0%, #3A8A3A 100%) !important;
}

.bg-primary:hover {
    background: linear-gradient(135deg, #3A8A3A 0%, #4A9A4A 100%) !important;
}

/* Override Bootstrap warning color - keep yellow for bookings */
.btn-warning {
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #000 !important;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-warning:hover {
    background-color: #ffca2c !important;
    border-color: #ffc720 !important;
    color: #000 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.bg-warning {
    background-color: #ffc107 !important;
}

/* Override Bootstrap info color - keep blue for events */
.btn-info {
    background-color: #0dcaf0 !important;
    border-color: #0dcaf0 !important;
    color: #000 !important;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-info:hover {
    background-color: #31d2f2 !important;
    border-color: #25cff2 !important;
    color: #000 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Light blue weight button (våg) on animal detail - matches PDF button style */
.btn-weight {
    background-color: #5bc0de !important;
    border-color: #5bc0de !important;
    color: #212529 !important;
    transition: var(--transition);
}

.btn-weight:hover {
    background-color: #4ab0ce !important;
    border-color: #4ab0ce !important;
    color: #212529 !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.bg-info {
    background-color: #0dcaf0 !important;
}

/* Icon buttons with transparent background and no border - info buttons */
.btn-sm.btn-info {
    background: transparent !important;
    border: none !important;
    color: #0dcaf0 !important;
    border-radius: var(--radius-lg);
    padding: 0.25rem 0.5rem;
}

.btn-sm.btn-info:hover {
    background: rgba(13, 202, 240, 0.1) !important;
    border: none !important;
    color: #0dcaf0 !important;
}

/* Icon buttons with transparent background and no border - warning buttons */
.btn-sm.btn-warning {
    background: transparent !important;
    border: none !important;
    color: #ffc107 !important;
    border-radius: var(--radius-lg);
    padding: 0.25rem 0.5rem;
}

.btn-sm.btn-warning:hover {
    background: rgba(255, 193, 7, 0.1) !important;
    border: none !important;
    color: #ffc107 !important;
}

/* Tab Navigation Styling (used in my-pages and animal-detail) */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: 3px solid transparent;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
    top: 2px;
}

.tab-button:hover {
    color: var(--primary);
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

.tab-button.active {
    color: var(--primary);
    border-color: var(--border-color);
    border-bottom-color: var(--primary);
    border-bottom-width: 3px;
    font-weight: 600;
    background-color: var(--bg-primary);
}

/* Tab content - only hide/show panels that follow our custom `.tabs` */
.tabs ~ .tab-content {
    display: none;
}

.tabs ~ .tab-content.active {
    display: block;
}

@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

