/* =============================================================
   EmployeeJustice.ai Platform Styles
   J&N Branding: Navy Blue + Gold
   ============================================================= */

:root {
    /* Brand Colors */
    --navy: #1e3a5f;
    --navy-dark: #152d4a;
    --navy-light: #2a4a73;
    --gold: #c4a052;
    --gold-dark: #a8893f;
    --gold-light: #d4b76a;
    
    /* Functional Colors */
    --primary: var(--navy);
    --primary-dark: var(--navy-dark);
    --primary-light: var(--navy-light);
    --accent: var(--gold);
    --accent-dark: var(--gold-dark);
    --accent-light: var(--gold-light);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    /* Radius */
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

/* =============================================================
   Login Page with Video Background
   ============================================================= */

.login-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.video-background video {
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(30, 58, 95, 0.85) 0%,
        rgba(30, 58, 95, 0.7) 50%,
        rgba(196, 160, 82, 0.4) 100%
    );
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.login-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(10px);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    max-width: 200px;
    height: auto;
    margin-bottom: 1rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.25rem;
}

.login-logo .powered-by {
    color: var(--gold);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Mobile: use still frame or reduce video quality */
@media (max-width: 768px) {
    .video-background video {
        display: block; /* Keep video on mobile, but could hide if performance is an issue */
    }
    
    .login-card {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .login-logo img {
        max-width: 160px;
    }
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--navy);
    color: var(--gold);
    width: 100%;
}

.btn-primary:hover {
    background: var(--navy-dark);
}

.btn-primary:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
}

.btn-accent {
    background: var(--gold);
    color: var(--white);
}

.btn-accent:hover {
    background: var(--gold-dark);
}

.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.hidden {
    display: none;
}

/* =============================================================
   Dashboard Layout
   ============================================================= */

.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 1.5rem;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    cursor: pointer;
}

.dashboard-brand:hover {
    opacity: 0.9;
}

.dashboard-brand img {
    height: 48px;
    width: auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}

.brand-text .powered-by {
    font-size: 0.75rem;
    color: var(--gold);
    font-weight: 500;
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    text-align: right;
}

.user-email {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: capitalize;
}

.btn-logout {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--navy);
    color: var(--white);
    border: none;
}

.btn-logout:hover {
    background: var(--navy-dark);
}

.dashboard-nav {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 1.5rem;
}

.nav-tabs {
    display: flex;
    gap: 0.25rem;
    list-style: none;
}

.nav-tab {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--navy);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    cursor: pointer;
}

.nav-tab:hover {
    color: var(--navy);
}

.nav-tab.active {
    color: var(--navy);
    border-bottom-color: var(--gold);
}

.nav-tab.locked {
    color: var(--gray-400);
    cursor: not-allowed;
}

.nav-tab.locked:hover {
    color: var(--gray-400);
}

.nav-tab.locked .tab-badge {
    color: var(--gray-400);
}

.nav-tab[data-module="s-drive"] .tab-badge {
    font-size: 0.7rem;
    margin-left: 0.5rem;
}

.lock-icon {
    margin-left: 0.375rem;
    font-size: 0.75rem;
}

.dashboard-content {
    flex: 1;
    padding: 1.5rem;
}

.module-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    height: calc(100vh - 200px);
    overflow: hidden;
}

.module-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.module-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray-500);
}

.module-placeholder svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    color: var(--gold);
}

.module-placeholder h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.module-placeholder p {
    font-size: 0.875rem;
}

/* =============================================================
   Dashboard Welcome (for Dashboard tab)
   ============================================================= */

.dashboard-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.dashboard-welcome img {
    max-width: 180px;
    margin-bottom: 1.5rem;
}

.dashboard-welcome h2 {
    font-size: 1.75rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.dashboard-welcome p {
    color: var(--gray-600);
    font-size: 1rem;
    max-width: 400px;
}

.dashboard-welcome .user-greeting {
    color: var(--gold);
    font-weight: 600;
}

/* =============================================================
   JaN Chatbot Widget
   ============================================================= */

.chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.chatbot-bubble {
    background: var(--navy);
    color: var(--white);
    padding: 12px 20px;
    border-radius: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-bubble:hover {
    background: var(--navy-dark);
    transform: translateY(-2px);
}

.chatbot-bubble svg {
    width: 20px;
    height: 20px;
}

.chatbot-bubble span {
    font-size: 0.875rem;
    font-weight: 500;
}

.chatbot-window {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 350px;
    height: 450px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.chatbot-window.open {
    display: flex;
}

.chatbot-header {
    background: var(--navy);
    color: var(--white);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-header .gold-text {
    color: var(--gold);
}

.chatbot-close {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.chatbot-close:hover {
    opacity: 1;
}

.chatbot-body {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.chatbot-body .coming-soon-icon {
    width: 64px;
    height: 64px;
    color: var(--gold);
    margin-bottom: 1rem;
}

.chatbot-body .typewriter {
    font-size: 1.125rem;
    color: var(--navy);
    font-weight: 500;
}

.chatbot-body .typewriter .cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--gold);
    margin-left: 2px;
    animation: blink 0.8s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.chatbot-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.chatbot-input-group {
    display: flex;
    gap: 0.5rem;
}

.chatbot-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--gray-200);
    color: var(--gray-500);
    cursor: not-allowed;
}

.chatbot-send {
    padding: 0.625rem;
    background: var(--gray-300);
    border: none;
    border-radius: var(--radius);
    cursor: not-allowed;
    color: var(--gray-500);
}

/* =============================================================
   Loading States
   ============================================================= */

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

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

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

@media (max-width: 640px) {
    .login-card {
        padding: 1.5rem;
    }
    
    .login-logo img {
        max-width: 160px;
    }
    
    .dashboard-header {
        padding: 0 1rem;
        height: 64px;
    }
    
    .dashboard-brand img {
        height: 40px;
    }
    
    .brand-text h1 {
        font-size: 1rem;
    }
    
    .user-info {
        display: none;
    }
    
    .nav-tabs {
        overflow-x: auto;
    }
    
    .nav-tab {
        padding: 0.875rem 1rem;
        white-space: nowrap;
    }
    
    .chatbot-window {
        width: calc(100vw - 48px);
        right: 0;
    }
}

/* =============================================================
   Dropdown Tab Navigation
   ============================================================= */

.tab-dropdown {
    position: relative;
    display: inline-block;
}

.tab-dropdown > .tab-button {
    cursor: pointer;
}

.tab-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 200px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--gray-200);
    z-index: 100;
    overflow: hidden;
}

.tab-dropdown:hover .tab-dropdown-content {
    display: block;
}

.tab-dropdown-content .tab-button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--navy);
    font-size: 0.95rem;
    transition: background 0.2s;
}

.tab-dropdown-content .tab-button:hover {
    background: var(--gray-100);
}

.tab-dropdown-content .tab-button.locked {
    opacity: 0.6;
    cursor: not-allowed;
    color: var(--gray-400);
}

.tab-dropdown-content .tab-button .tab-badge {
    font-size: 0.7rem;
    margin-left: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   MODULE IFRAME
   ═══════════════════════════════════════════════════════════════ */

.tab-panel {
    display: none;
    height: 100%;
}

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

.module-iframe {
    width: 100%;
    height: calc(100vh - 140px); /* Account for header + tabs */
    border: none;
    background: var(--navy-dark);
}

.tab-panel:has(.module-iframe) {
    padding: 0;
    overflow: hidden;
}

/* =============================================================
   Modal Overlay
   ============================================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 0;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--navy);
    color: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    opacity: 0.8;
}

.modal-content form {
    padding: 20px;
}

.modal-content .form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--white);
}

.modal-content .form-group select:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.form-error {
    color: var(--danger);
    background: #ffe6e6;
    padding: 10px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-size: 14px;
}

.form-success {
    color: var(--success);
    background: #e6ffe6;
    padding: 10px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-size: 14px;
}

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

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

/* =============================================================
   Users Panel
   ============================================================= */

.users-panel {
    padding: 24px;
    height: 100%;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.panel-header h2 {
    margin: 0;
    color: var(--navy);
    font-size: 1.5rem;
}

.panel-header .btn-primary {
    width: auto;
}

/* =============================================================
   Data Table
   ============================================================= */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--navy);
    color: var(--white);
    font-weight: 500;
    font-size: 0.875rem;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

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

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-700);
}

.role-badge.role-cto {
    background: var(--gold);
    color: var(--white);
}

/* Action Buttons */
.action-btn {
    padding: 6px 14px;
    font-size: 12px;
    margin-right: 4px;
    width: auto;
}

/* Loading and Error States */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
    font-size: 1rem;
}

.error-state {
    text-align: center;
    padding: 20px;
    color: var(--danger);
    background: #ffe6e6;
    border-radius: var(--radius);
    margin: 20px 0;
}

/* =============================================================
   Header Dropdown
   ============================================================= */

.header-dropdown {
    position: relative;
    cursor: pointer;
}

.header-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    display: none;
    z-index: 100;
    margin-top: 8px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.header-dropdown-menu.show {
    display: block;
}

.header-dropdown-menu a {
    display: block;
    padding: 12px 16px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.header-dropdown-menu a:hover {
    background: var(--gray-50);
}

.header-dropdown-menu a:first-child {
    border-bottom: 1px solid var(--gray-200);
}

/* Toast Notification */
#toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--navy);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: opacity 0.3s;
}
