/* Basic styles for Mackenzie Time Sheets */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f7fa;
    color: #2c3e50;
    min-height: 100vh;
}

.loading-msg-box {
    text-align: center;
    padding: 50px;
    color: #666;
}

header {
    background: white;
    color: #2c3e50;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-bottom: 1px solid #e5e7eb;
}

header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #1a202c;
}

header p {
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
    font-weight: 400;
    color: #64748b;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.row {
    display: flex;
    flex-wrap: wrap;
}

.col {
    flex: 1;
    padding: 2rem;
    min-width: 300px;
}

.col + .col {
    border-left: 1px solid #eee;
}

h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 1rem;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

li:last-child {
    border-bottom: none;
}

form div {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

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

button {
    background-color: #3b82f6;
    color: white;
    border: 1px solid #2563eb;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background-color: #2563eb;
}

button:active {
    transform: translateY(1px);
}

/* Login and Signup Page Styles */
.login-page,
.signup-page {
    padding: 2rem 1rem;
}

.login-container,
.signup-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h2,
.signup-container h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    margin-top: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group input:disabled {
    background-color: #f8f9fa;
    border-color: #e9ecef;
    color: #6c757d;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

.form-actions button {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
}

.form-actions button[type="submit"] {
    background-color: #3b82f6;
    color: white;
    border: 1px solid #2563eb;
}

.form-actions button[type="submit"]:hover:not(:disabled) {
    background-color: #2563eb;
}

.form-actions button[type="submit"]:disabled {
    background-color: #d1d5db;
    border-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

.form-actions button.secondary {
    background-color: white;
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

.form-actions button.secondary:hover {
    background-color: #3b82f6;
    color: white;
}

.error-message {
    background-color: #fee;
    color: #c33;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid #fcc;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

/* User info styling in header */
.user-info {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.user-info span {
    font-size: 0.95rem;
    font-weight: 400;
    color: #64748b;
}

.logout-button {
    background-color: #e5e7eb;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.logout-button:hover {
    background-color: #d1d5db;
    border-color: #9ca3af;
}

/* App Layout with Sidebar */
.app-container {
    display: flex;
    min-height: calc(100vh - 140px);
}

/* When app-container only has login/signup (no sidebar), center it */
.app-container > .login-page,
.app-container > .signup-page {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar {
    width: 250px;
    background: white;
    color: #2c3e50;
    display: flex;
    flex-direction: column;
    box-shadow: 1px 0 3px rgba(0,0,0,0.1);
    border-right: 1px solid #e5e7eb;
}

.nav-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.nav-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    color: #1a202c;
}

.nav-menu {
    flex: 1;
    padding: 1rem 0;
    list-style: none;
    margin: 0;
}

.nav-menu li {
    border-bottom: none;
    padding: 0;
}

.nav-menu li.active {
    background: #eff6ff;
    border-right: 3px solid #3b82f6;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 0.75rem;
}

.nav-menu a:hover {
    background: #f8fafc;
    color: #3b82f6;
}

.nav-icon {
    font-size: 1.2rem;
    width: 1.5rem;
    text-align: center;
}

.nav-text {
    font-weight: 500;
}

.nav-footer {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.nav-footer .user-info {
    margin: 0;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
}

.user-name {
    font-size: 0.875rem;
    text-align: center;
    color: #64748b;
}

.logout-btn {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.main-content {
    flex: 1;
    background: #f5f7fa;
    overflow-y: auto;
}

/* Page Content */
.page-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.page-header h1 {
    margin: 0;
    color: #1a202c;
    font-size: 1.875rem;
    font-weight: 600;
}

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.dashboard-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #3b82f6;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.dashboard-card h3 {
    margin: 0 0 0.5rem 0;
    color: #1a202c;
    font-size: 1.25rem;
    font-weight: 600;
}

.dashboard-card p {
    margin: 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* CRUD Item List and Grid */
.item-list {
    margin-top: 1.5rem;
}

.item-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.item-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
    flex: 0 0 320px;
    min-height: 200px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #2c3e50;
}

.item-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.item-card.pending {
    cursor: wait;
}

/* Spinner overlay for pending operations */
.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Delete button (next to edit button) */
.delete-btn {
    background: #ef4444;
    color: white;
    border: 1px solid #dc2626;
}

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

/* Add card styles */
.add-card {
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-card:hover {
    background: white;
    border-color: #3b82f6;
}

.add-icon {
    font-size: 3rem;
    color: #9ca3af;
    font-weight: 300;
}

/* Item content (view mode) */
.item-content {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.item-content:hover {
    cursor: pointer;
}

.item-header {
    margin-bottom: 1rem;
}

.item-header h4 {
    margin: 0;
    color: #1a202c;
    font-size: 1.25rem;
    font-weight: 600;
}

.item-details {
    flex: 1;
    margin-bottom: 1rem;
}

.item-date {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #64748b;
    display: flex;
}

.item-date .label {
    font-weight: 500;
    color: #475569;
    min-width: 50px;
}

.item-date .value {
    color: #64748b;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* Item edit form (edit mode) */
.item-edit-form {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.item-edit-form form {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.item-edit-form .form-group {
    margin-bottom: 1rem;
}

.item-edit-form .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.item-edit-form .form-group input,
.item-edit-form .form-group select,
.item-edit-form .form-group textarea {
    width: 100%;
    padding: 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    color: #1a202c;
    transition: all 0.2s ease;
}

.item-edit-form .form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

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

.item-edit-form .form-group input:focus,
.item-edit-form .form-group select:focus,
.item-edit-form .form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.item-edit-form .form-group select option {
    background: white;
    color: #1a202c;
}

.item-edit-form .form-actions {
    margin-top: auto;
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

/* Common button styles for all item buttons */
.item-btn {
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    flex: 1;
}

.save-btn {
    background: #10b981;
    color: white;
    border: 1px solid #059669;
}

.save-btn:hover:not(:disabled) {
    background: #059669;
}

.save-btn:disabled {
    background: #d1d5db;
    border-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

.cancel-btn {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.cancel-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Form Styles */
.form-container {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 0 auto;
}

.form-container h2 {
    margin: 0 0 1.5rem 0;
    color: #2c3e50;
    text-align: center;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border: 1px solid #2563eb;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}



.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #7f8c8d;
}

.empty-state p {
    margin: 0;
    font-size: 1.1rem;
}

/* Time Entry Table */
.time-entry-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-collapse: collapse;
}

.time-entry-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.time-entry-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.time-entry-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.15s ease;
}

.time-entry-table tbody tr:hover:not(.editing-row):not(.add-row) {
    background: #f9fafb;
    cursor: pointer;
}

.time-entry-table td {
    padding: 1rem;
    color: #1a202c;
}

.time-entry-table .btn-delete {
    background: #ef4444;
    color: white;
    border: 1px solid #dc2626;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.time-entry-table .btn-delete:hover {
    background: #dc2626;
}

.time-entry-table .add-row td {
    padding: 2rem 1rem;
    text-align: center;
}

.time-entry-table .btn-add {
    background: #10b981;
    color: white;
    border: 1px solid #059669;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.time-entry-table .btn-add:hover {
    background: #059669;
}

.time-entry-table .editing-row .inline-edit-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem;
}

.time-entry-table .editing-row select,
.time-entry-table .editing-row input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    flex: 1;
    min-width: 120px;
}

.time-entry-table .editing-row .form-actions {
    display: flex;
    gap: 0.5rem;
    margin: 0;
}

.time-entry-table .editing-row .btn-save,
.time-entry-table .editing-row .btn-cancel {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.time-entry-table .editing-row .btn-save {
    background: #10b981;
    color: white;
    border: 1px solid #059669;
}

.time-entry-table .editing-row .btn-save:hover:not(:disabled) {
    background: #059669;
}

.time-entry-table .editing-row .btn-save:disabled {
    background: #d1d5db;
    border-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

.time-entry-table .editing-row .btn-cancel {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.time-entry-table .editing-row .btn-cancel:hover {
    background: #f9fafb;
}

.time-entry-table .editing-row td {
    position: relative;
}

.time-entry-table tbody tr {
    position: relative;
}

/* Report Page */
.report-page {
    padding: 0;
}

.report-container {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
}

.report-left {
    flex: 0 0 400px;
}

.report-right {
    flex: 1;
    min-width: 0;
}

.report-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
}

.report-form select,
.report-form input {
    width: 100%;
    padding: 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}

.report-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.results-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
}

.results-table table {
    width: 100%;
    border-collapse: collapse;
}

.results-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.results-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
}

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

.results-table tbody tr:hover {
    background: #f9fafb;
}

.results-table td {
    padding: 0.875rem 1rem;
    color: #1a202c;
    font-size: 0.95rem;
}

.results-table td.pay-amount {
    font-weight: 600;
    color: #10b981;
}

.results-table td.overtime-indicator {
    font-weight: 500;
    color: #f59e0b;
}

.results-summary {
    padding: 1.5rem;
    background: #f9fafb;
    border-top: 2px solid #e5e7eb;
    font-size: 1.1rem;
    text-align: right;
}

.results-summary strong {
    color: #374151;
    font-weight: 600;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    .nav-menu {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem 0;
    }
    
    .nav-menu li {
        flex-shrink: 0;
    }
    
    .nav-menu a {
        flex-direction: column;
        padding: 0.75rem;
        text-align: center;
        min-width: 80px;
    }
    
    .nav-icon {
        margin-bottom: 0.25rem;
    }
    
    .nav-text {
        font-size: 0.8rem;
    }
    
    .nav-footer {
        display: none;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .item-grid {
        flex-direction: column;
        gap: 1rem;
    }
    
    .item-card {
        flex: 1 1 auto;
        min-height: auto;
    }
    
    .row {
        flex-direction: column;
    }
    
    .col + .col {
        border-left: none;
        border-top: 1px solid #eee;
    }
    
    .col {
        min-width: 0;
        padding: 1rem;
    }
    
    .login-container,
    .signup-container {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .form-actions {
        gap: 0.75rem;
    }
}
