/* ===================================
   TIMESHEET TOOL - Main Stylesheet
   Cedar Springs Camp Applications
   ================================ */

/* ===================================
   CSS Variables (from Style Guide)
   ================================ */

:root {
    /* Primary Colors */
    --color-orange: #FFA500;
    --color-dark-grey: #2c3e50;
    --color-medium-grey: #34495e;
    --color-light-grey: #f5f5f5;
    --color-white: #ffffff;

    /* Secondary Colors */
    --color-info-blue: #17a2b8;
    --color-info-blue-hover: #138496;
    --color-light-blue: #ecf7fd;
    --color-success-green: #27ae60;
    --color-warning-yellow: #FFC300;
    --color-danger-red: #e74c3c;

    /* Text Colors */
    --color-text-primary: #2c3e50;
    --color-text-secondary: #7f8c8d;
    --color-text-muted: #95a5a6;
    --color-text-light: #ecf0f1;

    /* Font Stack */
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
}

/* ===================================
   Base Styles
   ================================ */

body {
    font-family: var(--font-main);
    background: var(--color-light-grey);
    margin: 0;
    padding: 0;
    color: var(--color-text-primary);
}

.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-dark-grey);
}

.section-title {
    color: var(--color-orange);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
    margin-top: 10px;
}

/* ===================================
   Sidebar Navigation
   ================================ */

#sidebar {
    min-width: 250px;
    max-width: 250px;
    background: var(--color-dark-grey);
    color: var(--color-white);
    transition: all 0.3s;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 999;
    overflow-y: auto;
}

#sidebar.active {
    margin-left: -250px;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: var(--color-medium-grey);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#sidebar .sidebar-header h3 {
    color: var(--color-orange);
    font-weight: 600;
    margin-bottom: 8px;
    margin: 0;
}

#sidebar ul.components {
    padding: 20px 0;
}

#sidebar ul li {
    list-style: none;
}

#sidebar ul li a {
    padding: 12px 20px;
    font-size: 1em;
    display: block;
    color: var(--color-text-light);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

#sidebar ul li a:hover {
    color: var(--color-white);
    background: rgba(255,165,0,0.15);
    border-left-color: var(--color-orange);
}

#sidebar ul li.active > a {
    color: var(--color-orange);
    font-weight: 500;
    background: rgba(255,165,0,0.15);
    border-left-color: var(--color-orange);
}

#sidebar .CTAs {
    padding: 20px 0;
}

#sidebar .CTAs li a {
    padding: 12px 20px;
    font-size: 1em;
    display: block;
    color: var(--color-text-light);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

#sidebar .CTAs li a:hover {
    color: var(--color-white);
    background: rgba(255,165,0,0.15);
    border-left-color: var(--color-orange);
}

/* ===================================
   Content Area
   ================================ */

#content {
    width: calc(100% - 250px);
    padding: 20px;
    min-height: 100vh;
    transition: all 0.3s;
    background: var(--color-light-grey);
    margin-left: 250px;
}

#content.active {
    width: 100%;
    margin-left: 0;
}

/* ===================================
   Top Navigation Bar
   ================================ */

.navbar {
    padding: 15px 10px;
    background: var(--color-white);
    border: none;
    border-radius: 0;
    margin-bottom: 40px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.navbar h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-dark-grey);
}

/* ===================================
   Buttons
   ================================ */

.btn-info,
.btn-primary {
    background-color: var(--color-info-blue);
    border-color: var(--color-info-blue);
    color: white;
    padding: 12px 32px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-info:hover,
.btn-primary:hover {
    background-color: var(--color-info-blue-hover);
    border-color: #117a8b;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
    color: white;
}

.btn-secondary {
    background: var(--color-text-muted);
    color: white;
}

.btn-secondary:hover {
    background: var(--color-text-secondary);
    box-shadow: 0 4px 12px rgba(149, 165, 166, 0.3);
    color: white;
}

.btn-success {
    background-color: var(--color-success-green);
    border-color: var(--color-success-green);
}

.btn-success:hover {
    background-color: #229954;
    border-color: #1e8449;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* ===================================
   Forms and Inputs
   ================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-orange);
    box-shadow: 0 0 0 2px rgba(255,165,0,0.1);
}

.form-control:focus {
    border-color: var(--color-orange);
    box-shadow: 0 0 0 2px rgba(255,165,0,0.1);
}

/* Hide the default "Browse" button on file inputs */
input[type=file]::file-selector-button {
    display: none;
}

/* Custom file input styling */
.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
}

input.visually-hidden:focus + label,
input.visually-hidden:focus-within + label {
    outline: thin dotted;
}

/* ===================================
   Cards and Containers
   ================================ */

.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    color: var(--color-dark-grey);
    padding: 12px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: -30px -30px 20px -30px;
}

.card-body {
    padding: 20px;
}

/* ===================================
   Tables
   ================================ */

table {
    border: 1px solid black;
    border-collapse: collapse;
    width: 100%;
    margin: var(--spacing-sm);
    background: white;
}

th, td {
    text-align: left;
    padding: 12px;
    vertical-align: middle;
}

th {
    font-weight: 600;
    color: var(--color-dark-grey);
    background-color: #f8f9fa;
}

.table-striped tbody tr:nth-of-type(odd),
tbody tr:nth-child(even) {
    background-color: rgba(0,0,0,.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,.075);
}

/* Timesheet-specific table styles */
.shift-table th,
.shift-table td,
.small-text {
    font-size: xx-small;
}

.timesheet {
    height: 900px;
    width: 725px;
    margin-bottom: 20px;
}

.table-header {
    font-size: large;
    border-bottom: 1px solid black;
}

.name-cell {
    font-size: xx-large;
}

.code-row {
    font-size: small;
    background-color: var(--color-danger-red);
}

.titlerow {
    background-color: #BBB;
}

.total-line {
    font-weight: bold;
    background-color: #BBB;
}

.table-footer {
    padding-top: 20px;
    font-size: large;
}

/* Job Code Management */
.row.jobCodeHeader {
    font-weight: bold;
}

.evenRow, .oddRow {
    padding: 3px 5px;
}

.evenRow {
    background-color: var(--color-light-blue);
}

.actions .editButton {
    font-size: 100%;
    font-family: inherit;
    border: 0;
    padding: 0;
    background: none;
}

/* ===================================
   Alert Messages
   ================================ */

.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger,
.err-msg {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.err-msg h6 {
    color: #721c24;
    font-weight: 600;
    margin-bottom: 10px;
}

.alert-info {
    background-color: var(--color-light-blue);
    border: 1px solid var(--color-info-blue);
    color: #0c5460;
}

.alert-warning {
    background-color: #fff8e1;
    border: 1px solid var(--color-warning-yellow);
    color: #f57c00;
}

/* User info box */
.user-info-box {
    background: var(--color-light-blue);
    border-left: 4px solid var(--color-info-blue);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

/* Warning notice */
.warning-notice {
    background: #fff8e1;
    border-left: 4px solid var(--color-orange);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    color: #f57c00;
}

/* Message box styling */
#messagebox {
    display: block;
    padding: 0;
    margin-bottom: 20px;
}

#messagebox.clear {
    display: none;
}

#messagebox.error {
    border: thin solid var(--color-danger-red);
}

#messagebox.error #messageboxheader {
    background-color: var(--color-danger-red);
    font-weight: bold;
    font-size: 1.2rem;
    padding: 5px 10px;
    color: white;
}

#messagebox.info {
    border: thin solid var(--color-info-blue);
}

#messagebox.info #messageboxheader {
    background-color: var(--color-info-blue);
    font-weight: bold;
    font-size: 1.2rem;
    padding: 5px 10px;
    color: white;
}

#messagebox #messageboxbody {
    margin: 5px 10px;
}

/* ===================================
   Badges
   ================================ */

.env-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: bold;
    margin-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.env-production {
    background: var(--color-success-green);
    color: white;
}

.env-test {
    background: #3498db;
    color: white;
}

.env-development {
    background: var(--color-warning-yellow);
    color: var(--color-dark-grey);
}

.badge-primary {
    background-color: var(--color-info-blue);
    color: white;
}

.badge-warning {
    background-color: var(--color-warning-yellow);
    color: white;
}

/* ===================================
   Utility Classes
   ================================ */

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.ml-3 {
    margin-left: 1rem;
}

.text-muted {
    color: var(--color-text-muted);
}

/* Remove row buttons */
.remove-row {
    border: none;
    background: none;
    font-size: 1rem;
    line-height: 1;
    color: var(--color-danger-red);
    cursor: pointer;
    padding: 0 5px;
}

.remove-row:hover {
    color: #c0392b;
}

/* Underlined links */
.ts-link-underline {
    text-decoration: underline;
}

/* Environment badge in sidebar */
.ts-env-badge {
    display: flex;
    justify-content: center;
    width: 100%;
    background-color: var(--color-warning-yellow);
    margin-top: 2em;
    padding: 1em 0;
}

.ts-env-badge p {
    font-weight: bold;
    font-size: 1.3em;
    margin: 0;
    color: black;
}

/* ===================================
   Responsive Design
   ================================ */

/* Tablets and below */
@media (max-width: 768px) {
    #sidebar {
        margin-left: -250px;
    }

    #sidebar.active {
        margin-left: 0;
    }

    #content {
        width: 100%;
        margin-left: 0;
    }

    #content.active {
        margin-left: 250px;
    }

    #sidebarCollapse span {
        display: none;
    }

    .card {
        padding: 20px;
    }

    table {
        font-size: 0.9em;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .navbar h2 {
        font-size: 1.2rem;
    }

    .card {
        padding: 15px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    table {
        font-size: 0.8em;
    }

    th, td {
        padding: 8px;
    }
}

/* ===================================
   Sidebar Payroll Widget
   ================================ */

.sidebar-payroll-widget {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 4px;
}

.sidebar-widget-header {
    color: var(--color-orange);
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0 4px;
}

.sidebar-payroll-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-payroll-list li {
    display: flex;
    align-items: center;
    padding: 5px 4px;
    font-size: 0.85em;
    color: var(--color-text-light);
}

.payroll-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-orange);
    margin-right: 8px;
    flex-shrink: 0;
}

.payroll-date-label {
    flex: 1;
}

.payroll-day-label {
    color: var(--color-text-muted);
    font-size: 0.85em;
}

.sidebar-widget-link {
    display: block;
    margin-top: 8px;
    padding: 6px 4px;
    font-size: 0.8em;
    color: var(--color-orange) !important;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.sidebar-widget-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ===================================
   Payroll Calendar Page
   ================================ */

.payroll-calendar-container {
    max-width: 1200px;
}

.payroll-calendar-header {
    margin-bottom: var(--spacing-lg);
}

.payroll-calendar-layout {
    display: flex;
    gap: var(--spacing-lg);
    align-items: flex-start;
}

.payroll-calendar-main {
    flex: 3;
    min-width: 0;
}

.payroll-calendar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.payroll-calendar-panel {
    flex: 1;
    min-width: 220px;
    position: sticky;
    top: 20px;
}

/* Month cards */
.month-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.month-card-header {
    color: var(--color-white);
    background: var(--color-dark-grey);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    padding: 8px 12px;
    letter-spacing: 0.5px;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    text-align: center;
    padding: 8px;
}

.month-grid .day-header {
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: 4px 0;
    font-size: 0.7em;
    text-transform: uppercase;
}

.month-grid .day-cell {
    padding: 3px 1px;
    border-radius: 50%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    color: var(--color-text-primary);
}

.month-grid .day-cell.empty {
    visibility: hidden;
}

.month-grid .day-cell.weekend {
    color: var(--color-text-muted);
}

.month-grid .day-cell.payroll-highlight {
    background: var(--color-orange);
    color: var(--color-white);
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(255, 165, 0, 0.4);
}

.month-grid .day-cell.today-highlight {
    outline: 2px solid var(--color-info-blue);
    outline-offset: -1px;
}

/* Upcoming dates panel */
.upcoming-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    border: 1px solid #e9ecef;
    margin-bottom: var(--spacing-md);
}

.upcoming-card h4 {
    color: var(--color-orange);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    margin-top: 0;
}

.upcoming-month-group {
    margin-bottom: 12px;
}

.upcoming-month-label {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.upcoming-date-item {
    display: flex;
    align-items: center;
    padding: 5px 0;
    font-size: 0.88em;
    color: var(--color-text-primary);
}

.upcoming-date-item .payroll-dot {
    width: 8px;
    height: 8px;
}

.payroll-note {
    font-size: 0.8em;
    color: var(--color-text-muted);
    font-style: italic;
    margin-bottom: var(--spacing-md);
}

.payroll-print-btn {
    width: 100%;
}

/* ===================================
   Payroll Calendar - Responsive
   ================================ */

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

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

    .payroll-calendar-panel {
        position: static;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .payroll-calendar-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   Payroll Calendar - Print Styles
   ================================ */

@media print {
    /* Hide app chrome */
    #sidebar,
    .navbar,
    .payroll-print-btn {
        display: none !important;
    }

    #content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    .payroll-calendar-layout {
        display: block;
    }

    .payroll-calendar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .month-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .month-card-header {
        background: #333 !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .month-grid .day-cell.payroll-highlight {
        background: #333 !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .upcoming-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        margin-top: 20px;
    }

    .upcoming-month-group {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .payroll-note {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
