/* Global Layout */

html, body {
    height: 100%;
}

/* 
 * CSS Color Variables - Tenant Branding System
 * 
 * These variables are dynamically injected by the Flask context processor (inject_globals)
 * from the companies table. The values below are fallback defaults only.
 * 
 * Primary Colors (from tenant branding):
 *   --color-primary       : Main brand color (header, primary buttons, links)
 *   --color-primary-dark  : Auto-generated dark variant for hover states (20% darker)
 *   --color-primary-light : Auto-generated light variant for backgrounds (80% lighter)
 *   --color-accent        : Accent/action color (menu buttons, CTAs)
 * 
 * Semantic Colors (universal, not tenant-specific):
 *   --color-danger  : Error states, delete actions (red)
 *   --color-success : Success states, confirmations (green)
 *   --color-warning : Warnings, pending states (orange/yellow)
 * 
 * To customize tenant colors:
 *   1. Go to Admin → Company Profile
 *   2. Set Primary Color (for header/branding)
 *   3. Set Accent Color (for buttons/actions)
 *   4. Colors apply globally and persist in the database
 */
:root {
    --color-primary: #0a6ad1;
    --color-primary-dark: #0056b3;
    --color-primary-light: #0b51ad85;
    --color-accent: #ebb239;
    --color-danger: #e40707;
    --color-success: #28a745;
    --color-warning: #ffc107;
}

main {
    padding-bottom: 60px;   /* height of footer */
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    color: #333;
}

/* Page wrapper uses dynamic viewport height */
.tcc-page {
    min-height: calc(var(--vh, 1vh) * 100);
    height: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Calendar section: stable height */
.calendar-wrapper {
    min-height: calc(var(--vh, 1vh) * 80);
}

/* Login hero image or side panel */
.login-hero {
    height: calc(var(--vh, 1vh) * 50);
}



/* Header */
.header-container {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 85%, white) 0%, color-mix(in srgb, var(--color-primary) 100%, black 20%) 100%);
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Flex settings for header sections */
.left-info,
.center-info,
.right-info {
    display: flex;
    align-items: center;
}

.left-info {
    gap: 0.5rem;
    flex-wrap: nowrap;
    min-width: 0; /* Allow flex children to shrink */
}

/* Hide mobile user actions on desktop */
.mobile-user-actions {
    display: none;
}

/* Center section expands and keeps the title centered */
.center-info {
    flex: 1;
    justify-content: center;
}

/* Right section aligns its items to the right with spacing */
.right-info {
    justify-content: flex-end;
    gap: 1rem;           /* space between greeting and logout */
    /* drop text-align to let flex do the work */
    text-align: initial;
}

/* Logo height */
.header-container .left-info img {
    height: 70px;
}

/* Today date label */
.today-label {
    margin-left: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Title styling */
.header-container .center-info h1 {
    font-size: clamp(20px, 2.5vw, 30px);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    margin: 0;
}

/* Greeting text */
.header-container .right-info p {
    margin: 0;
    font-size: 21px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Profile icon link */
.profile-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
}

.profile-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.profile-icon {
    font-size: 24px;
    line-height: 1;
}

/* Language toggle */
.lang-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.lang-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 10px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-toggle-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.lang-flag-icon {
    display: inline-flex;
    width: 26px;
    height: 18px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
    opacity: 0.45;
    transform: scale(0.9);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.lang-flag-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.lang-flag-icon.is-active {
    opacity: 1;
    transform: scale(1);
}

.lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    padding: 8px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
    z-index: 50;
}

.lang-menu[hidden] {
    display: none;
}

.lang-option {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    color: #0f172a;
}

.lang-option:hover {
    background: #f1f5f9;
}

.lang-option.is-active {
    background: #e2e8f0;
}

/* Mobile-only language toggle (calendar) */
.mobile-lang-toggle {
    position: relative;
    display: none;
    align-items: center;
}

.mobile-lang-toggle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 8px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-lang-toggle-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-lang-toggle .lang-flag-icon {
    display: none;
}

.mobile-lang-toggle .lang-flag-icon.is-active {
    display: inline-flex;
}

.mobile-lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 120px;
    padding: 8px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
    z-index: 50;
}

.mobile-lang-menu[hidden] {
    display: none;
}

.mobile-lang-menu .lang-flag-icon {
    display: inline-flex;
}

.lang-manage {
    display: block;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    background: #eef2f7;
    color: #0f172a;
}

.lang-manage:hover {
    background: #e2e8f0;
}

/* Onboarding resume badge next to company name */
.ob-badge { display:inline-flex; align-items:center; margin-left:8px; background:#fff3cd; border:1px solid #ffeeba; border-radius:12px; padding:2px 6px; font-size:12px; }
.ob-badge .ob-link { color:#8a6d3b; text-decoration:none; margin-right:6px; }
.ob-badge .ob-link:hover { text-decoration:underline; }
.ob-badge .ob-dismiss { color:#8a6d3b; text-decoration:none; font-weight:700; }
.ob-badge .ob-dismiss:hover { color:#6e532e; }


.project-selection #viewCalendarLink {
    margin-left: 2.5rem;
    background-color: var(--color-accent) !important;
    color: rgb(15, 15, 15) !important;
    padding: 10px 15px !important;
    border: 2px solid var(--color-danger) !important;
    border-radius: 5px !important;
    text-decoration: none !important;
    font-size: 20px !important;
}

.project-selection #viewCalendarLink:hover {
    background-color: var(--color-primary-dark) !important;
}

.project-selection #commitReportBtn {
    font-size: 40px;
    margin-left: 2.5rem;
}

#viewReportBtn {
    margin-left: 2.5rem;
    background-color: var(--color-accent) !important;
    color: rgb(15, 15, 15) !important;
    padding: 10px 15px !important;
    border: 2px solid var(--color-danger) !important;
    border-radius: 5px !important;
    text-decoration: none !important;
    font-size: 20px !important;
}
#viewReportBtn:hover {
    background-color: var(--color-primary-dark) !important;
}
#commitReportBtn.flash-highlight {
    animation: flash-box 1s infinite;
    border: 3px solid var(--color-warning);
}
@keyframes flash-box {
    0%,100% { box-shadow: 0 0 0 0 var(--color-warning); }
    50%     { box-shadow: 0 0 15px 5px var(--color-warning); }
}


/* -------------------------------------------------- */
/* Shared styling for project and date selectors       */
.project-selection {
    display: flex;
    font-size: 30px !important;
    justify-content: center !important;
    align-items: center;
    width: 85%;
    background-color: var(--color-primary-light) !important;
    padding: 10px;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.project-selection label {
    font-size: clamp(22px, 2.8vw, 40px) !important;
    font-weight: bold;
    color: #007bff !important;
    margin-right: 10px;
}

.project-selection select {
    width: 400px !important;
    font-size: 10px !important;
    zoom: 1.5;
    background-color: #eff5ef !important;
    padding: 8px;
    color: #333 !important;
    border: 2px solid #007bff;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s ease-in-out;
}

.project-selection input[type="date"],
.project-selection input[type="text"] {
    width: 200px;
    font-size: 15px;
    zoom: 1.5;
    background-color: #eff5ef !important;
    padding: 6px;
    color: #333 !important;
    border: 2px solid #007bff;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-left: 20px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s ease-in-out;
}

.project-selection select:hover,
.project-selection input[type="date"]:hover {
    background-color: #eba8b3;
    border-color: #f1081c;
}

.project-selection select:focus,
.project-selection input[type="date"]:focus {
    outline: none;
    background-color: #f04360;
    border-color: #181716;
}

@media only screen and (max-width: 600px) {
    .project-selection {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        padding: 10px !important;
        gap: 8px !important;
        background-color: var(--color-primary-light) !important;
    }

    .project-selection label {
        font-size: 16px !important;
        color: var(--color-primary) !important;
        margin-right: 0 !important;
        text-align: left !important;
    }

    .project-selection select {
        width: 100% !important;
        font-size: 16px !important;
        zoom: 1 !important;
        background-color: #fff !important;
        padding: 10px !important;
        border: 2px solid var(--color-primary) !important;
        margin-left: 0 !important;
    }

    .project-selection input[type="date"],
    .project-selection input[type="text"] {
        width: 100% !important;
        font-size: 16px !important;
        zoom: 1 !important;
        padding: 10px !important;
        margin-left: 0 !important;
        background-color: #fff !important;
        border: 2px solid var(--color-primary) !important;
    }

    .project-selection select:hover,
    .project-selection input[type="date"]:hover {
        background-color: #f0f7ff !important;
        border-color: var(--color-primary-dark) !important;
    }

    .project-selection select:focus,
    .project-selection input[type="date"]:focus {
        outline: none;
        background-color: #fff !important;
        border-color: var(--color-primary) !important;
    }

    /* Date navigation container */
    .date-navigation {
        width: 100% !important;
        display: flex !important;
        gap: 6px !important;
    }

    .date-navigation input[type="date"] {
        flex: 1 !important;
    }

    /* Buttons in project selection */
    .project-selection button {
        width: 100% !important;
        margin: 4px 0 !important;
        padding: 10px !important;
        font-size: 16px !important;
    }
}

/* Logout Button */
#logoutButton {
    background-color: var(--color-accent) !important;
    color: rgb(15, 15, 15) !important;
    padding: 10px 15px !important;
    border: 2px solid var(--color-danger) !important;
    border-radius: 5px !important;
    text-decoration: none !important;
    font-size: 20px !important;
}

#logoutButton:hover {
    background-color: var(--color-primary-dark) !important;
}

/* Required field indicator */
.required {
    color: #c00;       
    margin-left: 0.25rem;
    font-weight: bold;
}

/*
 * Legacy styles for the project catalog "Add Project" button.
 * The button now inherits `.btn-main` rules from the admin React app,
 * so these overrides are commented out for clarity.
 */
/* #addProjectBtn {
    background-color: var(--color-accent) !important;
    color: rgb(15, 15, 15) !important;
    padding: 10px 15px !important;
    border: 2px solid var(--color-danger) !important;
    border-radius: 5px !important;
    text-decoration: none !important;
    font-size: 20px !important;
}

#addProjectBtn:hover {
    background-color: var(--color-primary-dark) !important;
}*/

/* Footer */
footer {
    background-color: #f8f9fa;
    text-align: center;
    padding: 10px 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    bottom: 0;
    width: 100%;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-logo {
    height: 40px;
    opacity: 0.8;
}

.footer-version {
    margin-left: 8px;
    font-size: 12px;
    color: #6c757d;
}

/* General Utilities */
.hidden {
    display: none !important;
}

/* Option state colors for report date selector */
.completed-day {
    background-color: #28a745 !important; /* green */
    color: #fff !important;
}

.incomplete-day {
    background-color: #ff9800 !important; /* orange */
    color: #000 !important;
}

/* Utility spacing classes */
.spaced-label {
    margin-left: 20px;
}

.ml-80 {
    margin-left: 80px;
}

.mt-20 {
    margin-top: 20px;
}

.full-width {
    width: 100%;
}


.center {
    text-align: center;
}

/* Weather Widget */
.weather-widget {
    display: flex;
    align-items: center;
    margin-left: 1rem;
    font-size: 1.25rem;   /* 25% larger text */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.weather-widget img {
    width: 1.5em;          /* scale icon up */
    height: auto;
    margin-right: 0.5em;   /* gap between icon and temp */
}

/* Standalone weather icon styling */
.weather-icon {
    vertical-align: middle;
    width: 50px;
    height: 50px;
    margin-right: 5px;
}


/* Header navigation menu */
.menu {
    display: flex;
    align-items: center;
}

.menu a {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    background-color: var(--color-accent);
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.menu a:hover {
    background-color: color-mix(in srgb, var(--color-accent) 100%, black 15%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
}

.btn-main {
    background-color: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-main:hover {
    background-color: color-mix(in srgb, var(--color-accent) 100%, black 15%);
    transform: translateY(-1px);
}

/* Circular back arrow button for report view */
#backToEntryBtn.back-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    font-size: 2rem;
    border-radius: 50%;
    border: 4px solid var(--color-success);
    color: var(--color-success);
    text-decoration: none;
    transition: background-color 0.2s;
}
#backToEntryBtn.back-arrow:hover {
    background-color: var(--color-success);
    color: #fff;
}
/* Tenant dropdown styles (header menu) */
.tenant-dropdown {
  display: inline-block;
  margin-left: 8px;
}
.tenant-dropdown > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  background: #2E74B5;
  color: #fff;
  border-radius: 4px;
}
.tenant-dropdown[open] > summary {
  background: #215985;
}
.tenant-dropdown .tenant-menu {
  position: absolute;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 6px 0;
  z-index: 1000;
}
.tenant-dropdown .tenant-menu a {
  display: block;
  padding: 6px 12px;
  color: #333 !important;
  text-decoration: none;
  white-space: nowrap;
  background: transparent !important;
  margin: 0 !important;
  border-radius: 0 !important;
  font-weight: normal !important;
}
.tenant-dropdown .tenant-menu a:hover {
  background: #f2f2f2;
}

/* Flash messages */
.flash-container {
  max-width: 960px;
  margin: 1rem auto;
  padding: 0 1rem;
}
.flash {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
}
.flash-success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.flash-info    { background: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
.flash-warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }
.flash-danger  { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
/* ════════════════════════════════════════════════════════════
   MOBILE HEADER OPTIMIZATIONS
   ════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Header: reduce padding for compact layout */
  .header-container {
    padding: 4px 8px !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    min-height: 48px !important;
  }

  /* Left section: column layout on mobile */
  .header-container .left-info {
    flex: 0 0 auto !important;
    min-width: 0 !important;
    gap: 4px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  /* Logo and date in same row */
  .logo-date-row {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .header-container .left-info img {
    height: 32px !important;
  }

  /* Mobile user actions: move to right side */
  .mobile-user-actions {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-left: auto !important;
    order: 2 !important;
  }

  .mobile-user-actions .profile-icon {
    font-size: 14px !important;
  }

  .mobile-user-actions .profile-link {
    width: 24px !important;
    height: 24px !important;
    padding: 3px !important;
  }

  .logout-compact {
    padding: 4px 8px !important;
    font-size: 18px !important;
    min-width: auto !important;
    line-height: 1 !important;
  }

  .calendar-page .mobile-user-actions {
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .calendar-page .mobile-user-actions .profile-link {
    width: 22px !important;
    height: 22px !important;
  }

  .calendar-page .mobile-user-actions .profile-icon {
    font-size: 13px !important;
  }

  .calendar-page .mobile-user-actions .logout-compact {
    padding: 2px 6px !important;
    font-size: 16px !important;
  }

  .calendar-page .mobile-lang-toggle {
    display: inline-flex !important;
  }

  .calendar-page .mobile-lang-toggle-button {
    height: 26px !important;
    padding: 0 6px !important;
  }

  .calendar-page .mobile-lang-toggle .lang-flag-icon {
    width: 20px !important;
    height: 14px !important;
  }

  /* Exit sign styling */
  .exit-sign {
    background: #2d9f4f !important;
    color: white !important;
    border: 1px solid #1f7a3a !important;
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    font-size: 14px !important;
    padding: 3px 6px !important;
  }

  .exit-sign:hover {
    background: #1f7a3a !important;
  }

  .exit-arrow {
    font-size: 16px !important;
    font-weight: bold !important;
  }

  .exit-icon {
    font-size: 14px !important;
  }

  /* Weather widget: below logo on mobile */
  .weather-widget {
    font-size: 0.7rem !important;
    margin-left: 0 !important;
    order: 1 !important;
  }

  .weather-widget img {
    width: 1em !important;
  }

  /* Hide desktop right-info on mobile */
  .right-info {
    display: none !important;
  }

  /* Show today-label on mobile next to logo */
  .today-label {
    display: inline-block !important;
    font-size: 0.75rem !important;
    margin-left: 0 !important;
    order: -1 !important;
  }

  /* Center section: smaller title */
  .center-info {
    flex: 1 1 100% !important;
    order: 3 !important; /* Move below left and right */
    justify-content: center !important;
    padding: 2px 0 !important;
  }

  .header-container .center-info h1 {
    font-size: 13px !important;
    text-align: center !important;
    margin: 0 !important;
    line-height: 1.2 !important;
  }

  /* Right section: compact */
  .right-info {
    flex: 0 0 auto !important;
    gap: 0.5rem !important;
    margin-left: auto !important;
  }

  /* Center menu navigation on mobile */
  .menu {
    display: flex !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding: 4px !important;
    flex: 1 1 100% !important;
    order: 3 !important;
  }

  .menu a {
    font-size: 11px !important;
    padding: 6px 10px !important;
  }

  /* Greeting: hide text, keep icon */
  .header-container .right-info p {
    display: none !important;
  }

  /* Profile link: smaller */
  .profile-link {
    width: 32px !important;
    height: 32px !important;
  }

  .profile-link svg {
    width: 20px !important;
    height: 20px !important;
  }

  /* Tenant dropdown: smaller */
  .tenant-dropdown > summary {
    padding: 4px 8px !important;
    font-size: 13px !important;
  }
}

/* Very small phones (≤375px) */
@media (max-width: 375px) {
  .header-container .left-info img {
    height: 32px !important;
  }

  .header-container .center-info h1 {
    font-size: 14px !important;
  }

  .profile-link {
    width: 28px !important;
    height: 28px !important;
  }
  /* Footer: compress to single line on mobile */
  footer {
    padding: 3px 4px !important;
    font-size: 9px !important;
    line-height: 1.2 !important;
    gap: 2px !important;
    min-height: 20px !important;
  }

  footer p {
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
  }

  .footer-logo {
    height: 14px !important;
    margin-right: 2px !important;
  }

  /* Adjust main content padding for smaller footer */
  .tcc-page {
    padding-bottom: 24px !important;
  }}
