/* ==========================================================================
   GLOBAL VARIABLES & THEME
   ========================================================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

:root {
    /* Light Mode Palette */
    --color-text: #040a09;
    --color-background: #e3f3e6;
    --color-primary: #3d6f87;
    --color-secondary: #456c8f;
    --color-accent: #555b8c;
    --color-nav-footer: #f5f8f5;

    /* Dark Mode Palette (future‑proofing) */
    --color-text-darkmode: #f4fbfa;
    --color-background-darkmode: #030706;
    --color-primary-darkmode: #47ae9e;
    --color-secondary-darkmode: #3f5190;
    --color-accent-darkmode: #343b7f;

    /* Interaction States */
    --color-primary-hover: #3e7a8f;
    --color-primary-active: #113f50;
    --color-primary-darkmode-hover: #5fc4b2;

    /* Focus Rings */
    --color-focus-ring-light: #555b8c;
    --color-focus-ring-dark: #a599e9;
}

/* ==========================================================================
   BASE STYLES & LAYOUT
   ========================================================================== */

html, body {
    height: 100%;
}

body {
    background-color: var(--color-background);
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

footer {
    background-color: var(--color-nav-footer);
}

/* ==========================================================================
   ACCESSIBILITY CHANGES
   Improve Contrast Scores
  ========================================================================== */

a {
    color: #0d55c2;
}

a:hover, a:focus {
    color: #2f566a;
}

.text-danger {
    color: #b02a37 !important;
}

.text-danger a {
    color: #9a1f2c !important;
}

.page-item.disabled .page-link {
    color: #495057 !important;   /* darker grey */
    border-color: #adb5bd !important; /* optional, improves contrast */
    opacity: 1 !important; /* Bootstrap dims disabled items; remove that */
}

/* Accessible danger badge */
.badge.bg-danger {
    background-color: #b02a37 !important; /* darker red */
    color: #ffffff !important;
}

.table-sort-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}


/* ==========================================================================
   NAVIGATION & HEADER
   ========================================================================== */

.custom-navbar {
    background-color: var(--color-nav-footer);
}

.nav-link {
    color: black;
}

.navbar .nav-link.active {
    color: var(--color-accent) !important;
    font-weight: 800;
}

.navbar-logo {
    max-height: 40px;
    width: auto;
}

/* Remove Safari/Chrome password autofill icon */
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
    visibility: hidden !important;
}

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

/* Primary Button */
.btn-primary {
    background-color: var(--color-primary) !important;
    border-color: var(--color-secondary) !important;
    color: white !important;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover) !important;
    border-color: var(--color-secondary-hover, #3d6487) !important;
    transform: translateY(-1px);
}

.btn-primary:active {
    background-color: var(--color-primary-active) !important;
    border-color: var(--color-secondary) !important;
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    color: white !important;
}

.btn-secondary:hover {
    background-color: var(--color-secondary-hover, #3d6487) !important;
    border-color: var(--color-secondary-hover, #3d6487) !important;
}

/* Outline Buttons */
.btn-outline-primary,
.btn-outline-secondary {
    color: black !important;
    background-color: transparent !important;
}

.btn-outline-primary {
    border-color: var(--color-primary) !important;
}

.btn-outline-secondary {
    border-color: var(--color-secondary) !important;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
    background-color: var(--color-primary-hover) !important;
    color: white !important;
}

/* ==========================================================================
   ALERT BACKGROUNDS
   ========================================================================== */

.bg-danger {
    background-color: #f7aa99 !important;
}

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

/* ==========================================================================
   HOME PAGE
   ========================================================================== */

.home-background .container {
    background: var(--color-nav-footer);
    border-radius: 2rem;
    padding: 1rem;
    box-shadow: 0 0 30px rgba(0,0,0,0.15);
}

/* ==========================================================================
   PAGINATION (Styled as Buttons)
   ========================================================================== */

.pagination {
    margin: 1rem 0;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pagination .page-link {
    color: white;
    background-color: var(--color-primary);
    border: 1px solid var(--color-secondary);
    min-width: 38px;
    padding: 0.375rem 0.75rem;
    text-align: center;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.pagination .page-link:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-secondary-hover, #3d6487);
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background-color: var(--color-primary-active);
    border-color: var(--color-secondary);
    font-weight: 600;
}

.pagination .page-item.disabled .page-link {
    background-color: #d3d3d3;
    border-color: #b0b0b0;
    color: #777;
    cursor: not-allowed;
}

/* ==========================================================================
   IMAGE HANDLING
   ========================================================================== */

.current-image-preview {
    width: 300px;
    height: auto;
    border-radius: 0.5rem;
    display: block;
}

.clickable-image {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.clickable-image:hover {
    opacity: 0.85;
}

#current-image-block a {
    display: inline-block;
}

/* Plant detail image */
.plant-image img {
    width: 100%;
    height: auto;
    max-width: 300px;
    object-fit: cover;
    display: block;
}

/* Prevent note images overflowing */
.notes-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   SORTABLE TABLE HEADERS
   ========================================================================== */

th.sortable {
    cursor: pointer;
    color: #0d6efd;
    text-decoration: underline;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    color: #0a58ca;
}

th.sortable i {
    margin-left: 4px;
    font-size: 0.9em;
    opacity: 0.7;
}

th.sortable.sort-asc i,
th.sortable.sort-desc i {
    opacity: 1;
    color: #0d6efd;
}

/* ==========================================================================
   SUMMERNOTE FIXES & ENHANCEMENTS
   ========================================================================== */

.note-editor .note-btn.active,
.note-editor .note-btn:active {
    background-color: var(--bs-primary-bg-subtle, #d0e3ff) !important;
    border-color: var(--bs-primary-border-subtle, #9ec5fe) !important;
    color: var(--bs-primary-text, #084298) !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,.15);
}

/* Fullscreen mode fix */
.note-editor.note-frame.fullscreen {
    position: fixed !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 1050 !important;
    background: #fff !important;
}

.note-editor.note-frame.fullscreen .note-editable {
    height: calc(100% - 50px) !important;
    overflow-y: auto !important;
}

/* ==========================================================================
   MEDIA QUERIES
   ========================================================================== */

/* Extra Small Devices (<375px) */
@media (max-width: 375px) {
    html {
        font-size: 15px;
    }

    .container-fluid {
        padding-left: 1px;
        padding-right: 1px;
    }
}

/* Small Mobile Devices (<576px) */
@media (max-width: 576px) {

    /* Summernote responsiveness */
    .note-editor {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .note-editor .note-editing-area,
    .note-editor .note-editable {
        max-width: 100% !important;
        overflow-x: hidden !important;
        word-wrap: break-word;
    }

    .note-toolbar {
        flex-wrap: wrap !important;
    }

    /* Pagination adjustments */
    .pagination .page-link {
        padding: 0.25rem 0.5rem;
        min-width: 30px;
        font-size: 0.875rem;
    }
}

/* Large Devices (≥992px) */
@media (min-width: 992px) {
    /* Reserved for future layout enhancements */
}
