/* Corporate Color Palette - Based on Company Logo */
:root {
    --primary-blue: #1e3a8a;
    --secondary-blue: #3b82f6;
    --light-blue: #dbeafe;
    --accent-blue: #1d4ed8;
    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #6b7280;
    --border-light: #e5e7eb;
    --background-light: #f8fafc;
    --white: #ffffff;
    --success-green: #10b981;
    --warning-orange: #f59e0b;
}

[x-cloak] {
    display: none !important;
}

/* Corporate styled body */
body {
    background: linear-gradient(135deg, var(--background-light) 0%, var(--light-blue) 100%);
    color: var(--text-dark);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Corporate header styling */
header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-blue) 100%);
    color: var(--white);
    padding: 1.5rem 2rem;
    margin: -20px -20px 2em -20px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

header h1 {
    color: var(--white);
    margin: 0;
    font-weight: 600;
    font-size: 1.5rem;
}

/* Special styling for the logout button in header - secondary white style */
header button {
    background: var(--white);
    color: var(--primary-blue);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

header button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent-blue);
    border-color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Corporate container styling */
div[x-data="jira"] {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
}

hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin: 1rem 0;
}

/* Button styling with corporate colors */
button {
    cursor: pointer;
    background: linear-gradient(135deg, var(--secondary-blue) 0%, var(--accent-blue) 100%);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

button:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--primary-blue) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Input styling */
input, select {
    border: 2px solid var(--border-light);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--white);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--secondary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Link styling */
a {
    cursor: pointer;
    text-decoration: none;
    color: var(--secondary-blue);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

summary {
    cursor: pointer;
    text-decoration: none;
}

table {
    direction: ltr;
}

/* Table styling with corporate theme */
.table-container {
    transition: width 0.3s ease;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

table {
    transition: all 0.3s ease;
    border-collapse: collapse;
}

/* Corporate table headers */
th {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-blue) 100%);
    color: var(--white);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
    border-bottom: 2px solid var(--primary-blue);
}

/* Table cells styling */
td, th {
    transition: width 0.3s ease, padding 0.2s ease;
    border-bottom: 1px solid var(--border-light);
}

tr:hover td {
    background-color: var(--light-blue);
}

/* User rows with alternating colors */
tbody tr:nth-child(even) {
    background-color: var(--background-light);
}

/* Status indicators */
.loading-indicator {
    background: linear-gradient(135deg, var(--light-blue) 0%, var(--background-light) 100%);
    border: 2px solid var(--secondary-blue);
    color: var(--primary-blue);
    border-radius: 8px;
}

.loading-spinner {
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--secondary-blue);
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

/* Smooth transitions for collapsible elements */
details {
    transition: all 0.3s ease;
    border-radius: 6px;
    padding: 0.5rem;
    margin: 0.25rem 0;
    background: var(--background-light);
}

details summary {
    transition: all 0.2s ease;
    padding: 0.25em 0;
    font-weight: 500;
    color: var(--text-medium);
}

details summary:hover {
    color: var(--primary-blue);
    background-color: var(--light-blue);
    border-radius: 4px;
    padding: 0.25em 0.5em;
}

details[open] {
    background: var(--white);
    border-color: var(--secondary-blue);
}

details[open] summary {
    margin-bottom: 0.5em;
    color: var(--primary-blue);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.5em;
}

details>div {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Nested details styling with corporate theme */
details details {
    margin-left: 0.5em;
    border-left: 3px solid var(--secondary-blue);
    padding-left: 0.5em;
    background: var(--white);
    border-radius: 0 4px 4px 0;
}

details details summary {
    font-size: 0.9em;
    color: var(--text-medium);
    font-weight: 500;
}

details details[open] summary {
    color: var (--primary-blue);
}

/* Comment text styling with better readability */
.comment-text {
    display: block;
    max-width: 700px;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.4;
    overflow-wrap: break-word;
    color: var(--text-medium);
    background: var(--background-light);
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid var(--secondary-blue);
}

/* Project name styling */
.project-name {
    font-size: 0.85em;
    color: var(--primary-blue);
    font-weight: 600;
}

/* Form section styling */
form {
    background: var(--background-light);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Date inputs row */
form .date-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Button row - justified to the right */
form .button-row {
    display: flex;
    justify-content: flex-end;
}

label {
    color: var(--text-dark);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.main-form {
    background: transparent;
    border: none;
}

/* Success and warning states */
.success {
    color: var(--success-green);
}

.warning {
    color: var(--warning-orange);
}

/* Total hours styling */
.total-hours {
    background: linear-gradient(135deg, var(--light-blue) 0%, var(--background-light) 100%);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--secondary-blue);
    font-weight: 600;
    color: var(--primary-blue);
}

/* Time tracking information styling */
.time-tracking-info {
    color: var(--text-light);
    font-size: 0.75em;
    margin-left: 0.5em;
    padding: 0.1em 0.4em;
    background: var(--background-light);
    border-radius: 3px;
    border: 1px solid var(--border-light);
    font-weight: 500;
}

.time-tracking-info .estimation {
    color: var(--warning-orange);
}

.time-tracking-info .invested {
    color: var(--primary-blue);
}

.time-tracking-info .separator {
    color: var(--text-light);
    margin: 0 0.2em;
}

@media print {
    /* Reset to clean print layout */
    body {
        background: white !important;
    }

    /* Hide interactive elements when printing */
    button,
    header,
    details {
        display: none !important;
    }

    /* Reset body margins and padding for print */
    body {
        margin: 0 !important;
        padding: 0 !important;
        color: black !important;
    }

    /* Make main container full width for print */
    div[x-data="jira"] {
        max-width: none !important;
        margin: 0 !important;
        padding: 10px !important;
        box-shadow: none !important;
        border: none !important;
        background: white !important;
    }

    /* Hide non-table content when printing all users view */
    div[x-show*="currentView === 'invertidas' && currentUserAccountId"] > div:first-child,
    div[x-show*="submitting && currentUserAccountId === 'all-users'"],
    form,
    p[x-show*="!currentUserAccountId"] {
        display: none !important;
    }

    /* Print-specific table container styling */
    .table-container {
        width: 100% !important;
        margin: 0 !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
        overflow: visible !important;
        border: 1px solid black !important;
        border-radius: 0 !important;
        page-break-inside: avoid;
        box-shadow: none !important;
    }

    /* Table adjustments for print */
    table {
        width: 100% !important;
        min-width: auto !important;
        font-size: 11px !important;
        page-break-inside: auto;
        margin-top: 0 !important;
    }

    /* Print table headers */
    th {
        background: #1e3a8a !important;
        color: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Adjust table cell padding for print */
    td, th {
        padding: 4px 6px !important;
        font-size: 11px !important;
        border: 1px solid #ccc !important;
    }

    /* Ensure table headers repeat on each page */
    thead {
        display: table-header-group;
    }

    /* Prevent page breaks within table rows */
    tr {
        page-break-inside: avoid;
    }

    /* Adjust comment text width for print */
    .comment-text {
        max-width: none !important;
        font-size: 10px !important;
        background: transparent !important;
        border: none !important;
        padding: 2px !important;
    }
    /* Project name for print */
    .project-name {
        color: black !important;
        font-weight: bold !important;
    }

    /* Time tracking info for print */
    .time-tracking-info {
        color: black !important;
        background: transparent !important;
        border: none !important;
        font-size: 9px !important;
    }

    .time-tracking-info .estimation,
    .time-tracking-info .invested {
        color: black !important;
    }

    /* Links for print */
    a {
        color: black !important;
        text-decoration: underline !important;
    }

    /* Force table template to show on first page */
    template[x-if*="currentUserAccountId === 'all-users'"] + div,
    div.table-container {
        page-break-before: avoid !important;
        margin-top: 0 !important;
    }
}
