/* ===== CSS VARIABLES ===== */
:root {
    --primary-color: #2c4e5f;
    --primary-dark: #5a3b52;
    --primary-light: #8b5f7e;
    --accent-color: #00A09D;
    --accent-dark: #008b89;

    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #6b7280;

    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --bg-lighter: #f3f4f6;

    --border-color: #e5e7eb;
    --border-light: #f3f4f6;

    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --transition: all 0.2s ease;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
}

.navbar-brand {
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: white;
}

.navbar-logo {
    height: 40px;
    width: 40px;
    vertical-align: middle;
}

.navbar-menu {
    list-style: none;
    display: flex;
    padding: 0;
    margin: 0;
}

.navbar-menu li {
    position: relative;
}

.navbar-menu a {
    display: block;
    padding: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.navbar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.navbar-menu a.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.navbar-menu a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-color);
}

.navbar-user {
    margin-left: auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-user span {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* ===== BUTTONS ===== */
button, .btn {
    padding: 0.5rem 1rem;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    text-align: center;
}

.btn-primary, button[type="submit"] {
    background: var(--accent-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover, button[type="submit"]:hover {
    background: var(--accent-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-lighter);
    border-color: var(--text-light);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 13px;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

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

/* ===== MAIN CONTENT ===== */
.main-content {
    margin: 0 auto;
}

/* ===== CARDS & SECTIONS ===== */
.admin-users,
.dashboard,
.timesheet-entry,
.projects-page,
.login-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
}

.admin-header,
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bg-lighter);
}

.admin-header h2,
.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

/* ===== TABLES ===== */
.users-table,
.timesheets-table {
    margin-top: 1.5rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-white);
}

thead {
    background: var(--bg-lighter);
}

thead th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

thead th:first-child {
    border-top-left-radius: var(--radius-md);
}

thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

tbody tr:hover {
    background: var(--bg-light);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 1rem;
    color: var(--text-dark);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.admin {
    background: var(--primary-light);
    color: white;
}

.badge.user {
    background: var(--accent-color);
    color: white;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 13px;
    font-weight: 500;
    border-radius: 12px;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status.active {
    background: var(--success-light);
    color: var(--success);
}

.status.active::before {
    background: var(--success);
}

.status.inactive {
    background: var(--error-light);
    color: var(--error);
}

.status.inactive::before {
    background: var(--error);
}

/* ===== FORMS ===== */
.form-group {
    text-align: center;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

.form-group label span {
    color: var(--text-light);
    font-weight: 400;
    font-size: 13px;
}

select,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-white);
}

select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 160, 157, 0.1);
}

.form-group input:disabled,
select:disabled {
    background: var(--bg-lighter);
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-row .form-group {
    margin-bottom: 0;
}

.inline-form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* ===== NEW USER FORM ===== */
.new-user-form {
    background: var(--bg-lighter);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-color);
    display: none;
}

.new-user-form:not(:empty) {
    display: block;
}

.new-user-form h3 {
    margin-bottom: 1.25rem;
    color: var(--text-dark);
    font-size: 1.125rem;
}

.user-edit-row {
    background: var(--bg-lighter) !important;
}

.user-edit-row td {
    padding: 1.5rem 1rem !important;
}

/* ===== ODOO CONFIG SECTION ===== */
.odoo-config-section {
    background: var(--bg-lighter);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

/* ===== FILTERS ===== */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-lighter);
    border-radius: var(--radius-md);
    align-items: center;
}

.form-group.inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0;
}

.form-group.inline label {
    margin-bottom: 0;
    white-space: nowrap;
}

.form-group.inline input {
    width: auto;
    min-width: 150px;
}

/* ===== SUMMARY CARDS ===== */
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-dark) 100%);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    color: white;
}

.summary-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

/* ===== PROJECTS PAGE ===== */
.projects-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.projects-list h3,
.tasks-list h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.projects-list ul {
    list-style: none;
}

.projects-list li,
.project-item {
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-lighter);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.projects-list li:hover,
.project-item:hover {
    background: var(--bg-light);
    border-left-color: var(--accent-color);
    transform: translateX(4px);
}

.projects-list li.active,
.project-item.active {
    background: var(--accent-color);
    color: white;
    border-left-color: var(--accent-dark);
    font-weight: 500;
}

.tasks-list {
    background: var(--bg-lighter);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    min-height: 300px;
}

.tasks-list ul {
    list-style: none;
}

.tasks-list li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 2rem;
}

.login-box {
    background: var(--bg-white);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

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

.login-box button {
    display: block;
    margin: 10px auto;
}

/* ===== MESSAGES ===== */
.message,
.error-message {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message.success,
.success {
    background: var(--success-light);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.message.error,
.error,
.error-message {
    background: var(--error-light);
    color: var(--error);
    border-left: 4px solid var(--error);
}

.message.warning {
    background: var(--warning-light);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar-menu {
        flex-wrap: wrap;
    }

    .navbar-user {
        width: 100%;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .projects-container {
        grid-template-columns: 1fr;
    }

    .summary {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-users,
.dashboard,
.timesheet-entry,
.projects-page {
    animation: fadeIn 0.3s ease;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-lighter);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ===== LOADING STATE ===== */
[hx-get], [hx-post], [hx-put], [hx-delete] {
    position: relative;
}

.htmx-request {
    opacity: 0.7;
    pointer-events: none;
}

.htmx-request::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--accent-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== FOOTER ===== */
footer {
    background: var(--primary-dark);
    text-align: center;
    padding: 1rem 2rem;
    font-size: 14px;
    position: fixed;
}

.timesheets-list {
    margin: 0 auto;
    padding: 20px;
}

.filters-section {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.filter-field input,
.filter-field select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.filter-actions {
    display: flex;
    align-items: end;
}

.filter-actions button {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.filter-actions button:hover {
    background: #5a6268;
}

.timesheets-header {
    margin-bottom: 15px;
}

.timesheets-summary {
    display: flex;
    gap: 30px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 4px;
}

.timesheets-table th,
.timesheets-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.timesheets-table tr:hover {
    background: #f8f9fa;
}

.actions {
    white-space: nowrap;
}

.btn-edit,
.btn-delete,
.btn-save,
.btn-cancel {
    padding: 6px 12px;
    margin-right: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-edit {
    background: #007bff;
    color: white;
}

.btn-edit:hover {
    background: #0056b3;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-save {
    background: #28a745;
    color: white;
}

.btn-save:hover {
    background: #218838;
}

.btn-cancel {
    background: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background: #5a6268;
}

.edit-row {
    background: #fff3cd !important;
}

.inline-edit-form {
    padding: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    align-items: end;
}

.form-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 500;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.form-actions {
    display: flex;
    gap: 5px;
    align-items: end;
}

.infinite-scroll-trigger {
    text-align: center;
    padding: 20px;
}

.htmx-indicator {
    display: none;
    color: #666;
    font-style: italic;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

#loading {
    text-align: center;
    padding: 10px;
}

/* Page container */
/* Page container */
.timesheets-create-list,
.setting-change-password {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

/* Header */
.timesheet-header,
.password-header {
    text-align: center;
    margin-bottom: 1rem;
}

/* Success message */
.success-message {
    margin-bottom: 1rem;
    color: #2e7d32;
    font-size: 0.9rem;
    text-align: center;
}

/* Form wrapper */
.timesheet-create-form {
    width: 100%;
    max-width: 420px; /* nice mobile + desktop width */
}

/* Force column layout */
.form-line {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Fields */
.form-field {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Labels */
.form-field label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

/* Inputs & selects */
.form-field input,
.form-field select {
    padding: 0.55rem 0.65rem;
    font-size: 0.9rem;
    width: 100%;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* Submit button */
.timesheet-create-form button[type="submit"],
.password-create-form button[type="submit"] {
    margin-top: 1rem;
    padding: 0.65rem;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
    text-align: center;
    display: inline-block;
}
