/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    overflow-x: hidden;
}

/* Default body layout for non-login pages */
body:not(.login-page) {
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    width: 100%;
}

/* Header */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    font-size: 0.9rem;
}

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

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

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

input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Password Input Container */
.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container input {
    padding-right: 3rem; /* Make room for the toggle button */
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 0.9rem;
    padding: 0.25rem;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.password-toggle:hover {
    background-color: #f0f0f0;
    color: #333;
}

.password-toggle:focus {
    outline: none;
    background-color: #e0e0e0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-success {
    background-color: #27ae60;
}

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

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.card-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

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

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Filters */
.filters {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

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

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .nav-info {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .nav-info .user-info {
        margin-bottom: 5px;
    }

    .nav-info button, 
    .nav-info .btn {
        width: 100%;
        margin: 0;
    }
    
    .form-container {
        margin: 0.5rem auto;
        padding: 1rem;
        width: 100%;
    }
    
    body.login-page .form-container {
        margin: 0;
        padding: 1rem;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    body.login-page .container {
        padding: 5px;
    }
    
    /* Mobile: Stack sections vertically */
    body.login-page .login-content {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    body.login-page .tab-section {
        min-width: unset;
        max-width: unset;
        width: 100%;
    }
    
    body.login-page .form-container {
        padding: 0.8rem;
    }
    
    body.login-page h1 {
        font-size: 1.3rem;
    }
    
    body.login-page .tab-info {
        padding: 0.4rem;
    }
    
    body.login-page .tab-info h3 {
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.85rem;
        min-width: 600px; /* Ensure table doesn't squish too much */
    }
    
    th, td {
        padding: 0.5rem;
        white-space: nowrap; /* Prevent wrapping in cells */
    }

    /* Make buttons easier to tap */
    .btn {
        padding: 0.8rem 1rem;
        min-height: 44px;
    }

    /* Adjust card padding */
    .card {
        padding: 1rem;
    }
}

/* Login Tabs */
.login-tabs {
    display: flex;
    border-bottom: 2px solid #ecf0f1;
    margin-bottom: 2rem;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
}

.login-tabs .tab-btn {
    flex: 1;
    background: #ecf0f1;
    border: none;
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    color: #7f8c8d;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.login-tabs .tab-btn:hover {
    background: #d5dbdb;
    color: #2c3e50;
}

.login-tabs .tab-btn.active {
    background: white;
    color: #2c3e50;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #3498db;
}

.tab-info h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1.1rem;
}

.tab-info p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}



.employer-btn {
    background-color: #e74c3c;
}

.employer-btn:hover {
    background-color: #c0392b;
}

.employee-btn {
    background-color: #27ae60;
}

.employee-btn:hover {
    background-color: #229954;
}

/* Role Management Styles */
.role {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.role-admin {
    background-color: #e74c3c;
    color: white;
}

.role-employee {
    background-color: #3498db;
    color: white;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: 100px;
}

.admin-protected {
    color: #95a5a6;
    font-size: 0.8rem;
    font-style: italic;
    padding: 4px 8px;
}

/* Button variants for role management */
.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Export Section Styles */
.export-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.export-section h4 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.export-buttons > button {
    align-self: flex-start;
}

.individual-exports {
    margin-top: 15px;
}

.individual-exports h5 {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.employee-export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.employee-export-btn {
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #3498db;
    background-color: white;
    color: #3498db;
    transition: all 0.2s ease;
}

.employee-export-btn:hover {
    background-color: #3498db;
    color: white;
    transform: translateY(-1px);
}

.btn-outline-primary {
    border: 1px solid #3498db;
    color: #3498db;
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: #3498db;
    color: white;
}

/* Filter section enhancements */
.filters {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.filters h3 {
    color: #495057;
    margin-bottom: 15px;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.hidden { display: none; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 1rem; }

/* Login Page Specific Styles - No Scrolling, Compact Design */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 10px;
    overflow: hidden;
}

body.login-page .container {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
}

body.login-page .form-container {
    margin: 0;
    width: 100%;
    max-width: 900px;
    height: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Compact header */
body.login-page h1 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

body.login-page .text-center p {
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

/* Horizontal tab layout for larger screens */
body.login-page .login-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

body.login-page .tab-section {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

body.login-page .tab-section.active {
    border-color: #3498db;
    background: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

/* Compact tab info */
body.login-page .tab-info {
    padding: 0.5rem;
    margin-bottom: 0.8rem;
    background: #e3f2fd;
    border-radius: 6px;
}

body.login-page .tab-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

body.login-page .tab-info p {
    font-size: 0.8rem;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Compact form elements */
body.login-page .form-group {
    margin-bottom: 0.6rem;
}

body.login-page label {
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

body.login-page input {
    padding: 0.6rem;
    font-size: 0.9rem;
}

body.login-page .btn {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
}

/* Hide traditional tabs, show both sections */
body.login-page .login-tabs {
    display: none;
}

body.login-page .tab-content {
    display: block !important;
}

/* Compact registration info */
body.login-page .registration-info {
    margin-top: 1rem;
    padding: 0.8rem;
    font-size: 0.8rem;
    text-align: center;
    background: #e8f6f3;
    border-radius: 6px;
}

/* Remove any transform animations that cause movement */
body.login-page * {
    transform: none !important;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Reports Tab Styles */
.report-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.report-type-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.report-type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.report-type-card h4 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.2rem;
}

.date-range-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.date-range-group .form-group {
    flex: 1;
    min-width: 120px;
}

.report-type-card .btn {
    margin-top: 15px;
    padding: 10px 20px;
    font-weight: 600;
}

/* Admin Tab Navigation Styles */
.tabs {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 140px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    background-color: #3498db;
    color: white;
}

/* Simple blue styling for all tabs */
.tab-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Active tab styling */
.tab-btn.active {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
    border: 2px solid #fff;
}

/* Responsive design for tabs */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .tab-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* ==========================================
   AI Chatbot Styles
   ========================================== */

.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.chatbot-icon {
    font-size: 28px;
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    font-size: 32px;
}

.chatbot-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.chat-message {
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.bot-message {
    align-self: flex-start;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message-content {
    padding: 12px 16px;
    line-height: 1.5;
    font-size: 14px;
}

.message-content p {
    margin: 0 0 8px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
}

.message-content strong {
    font-weight: 600;
}

.example-query {
    background: #f0f0f0;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #667eea;
    transition: background 0.2s;
    margin: 4px 0 !important;
}

.example-query:hover {
    background: #e0e0e0;
}

.error .message-content {
    background: #fee2e2;
    color: #dc2626;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.chatbot-input-container {
    padding: 12px 16px 16px;
    background: white;
    border-top: 1px solid #eee;
}

.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.suggestion-btn {
    background: #f0f4ff;
    border: 1px solid #d0d7ff;
    color: #667eea;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chatbot-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.chatbot-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chatbot-send span {
    font-size: 18px;
}

/* Chatbot responsive styles */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        right: -10px;
        bottom: 70px;
        height: calc(100vh - 100px);
        border-radius: 12px;
    }

    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }

    .chatbot-icon {
        font-size: 24px;
    }
}