/* HR360 - Modern Web App Styles */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #10b981;
    --success-bg: #d1fae5;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --error: #ef4444;
    --error-bg: #fee2e2;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #f1f5f9;
    --sidebar-width: 280px;
    --sidebar-rail: 78px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --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);
    --transition: 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    padding: 1rem;
}

/* ========== App Layout ========== */
.app-body {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform var(--transition), box-shadow var(--transition), width var(--transition), min-width var(--transition);
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-logo-img {
    height: 40px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
}

.header-logo-img {
    height: 36px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    display: block;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background var(--transition), color var(--transition);
    margin-bottom: 2px;
}

.sidebar .nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.04);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: #fff;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar .user-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    font-size: 0.75rem;
    color: var(--sidebar-text);
    margin-top: 2px;
}

.sidebar .nav-item.logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.sidebar-overlay {
    display: none !important;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.5rem;
    min-width: 40px;
    min-height: 40px;
    cursor: pointer;
    color: var(--text);
    border-radius: var(--radius-sm);
}

.menu-toggle:hover {
    background: var(--bg);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    flex: 1;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb-sep {
    color: var(--border);
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 500;
}

.topbar-spacer {
    flex: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.topbar-role {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 6px;
    font-weight: 500;
}

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

/* ========== Login ========== */
.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    animation: slideUp 0.4s ease;
}

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

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

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

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

.login-box label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.login-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-box .btn-primary {
    width: 100%;
    padding: 0.875rem;
    margin-top: 0.5rem;
    font-size: 1rem;
}

.login-demo {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.login-demo strong {
    color: var(--text);
}

.login-demo code {
    background: var(--surface);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* ========== Container & Page Header ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.page-header .subtitle,
.page-header p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.dashboard-header .subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 0.25rem;
}

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

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.25rem 0 1rem;
    line-height: 1.2;
}

.stat-card .btn {
    margin-top: 0;
}

/* ========== Section & Cards ========== */
.section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 1.25rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-header h2, .card-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row strong {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ========== Forms ========== */
.form-container {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

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

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

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input.invalid,
.form-group select.invalid {
    border-color: var(--error);
}

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

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

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

.form-group input[type="file"] {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--transition);
}

.form-group input[type="file"]:hover {
    border-color: var(--primary);
}

.form-group input[type="file"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* KPI list */
.kpi-list {
    margin: 1.5rem 0;
}

.kpi-list > h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.kpi-item {
    background: var(--bg);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.rating-section {
    background: var(--bg);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    margin: 1.25rem 0;
    border: 1px solid var(--border);
}

.rating-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* ========== Rating display & stars ========== */
.rating-display {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rating-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.875rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.rating-value {
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
}

.rating-stars {
    display: inline-flex;
    gap: 2px;
}

.rating-stars .star {
    color: var(--border);
}

.rating-stars .star.filled {
    color: #fbbf24;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

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

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

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

/* ========== Badges ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-draft {
    background: var(--warning-bg);
    color: #b45309;
}

.badge-submitted {
    background: var(--success-bg);
    color: #047857;
}

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

/* ========== Tables ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.data-table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}

.data-table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    transition: background var(--transition);
}

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

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

/* Feedback rating badges */
.rating-badge {
    display: inline-block;
    min-width: 3.5rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}
.rating-good {
    background-color: #e6f6ec;
    color: #1c7c3a;
}
.rating-ok {
    background-color: #fff7e6;
    color: #b56a00;
}
.rating-low {
    background-color: #fde8e8;
    color: #c22727;
}

/* Benchmarking heat map */
.heat-item.heat-high { background: #d1fae5; color: #065f46; }
.heat-item.heat-medium { background: #fef3c7; color: #92400e; }
.heat-item.heat-low { background: #fee2e2; color: #991b1b; }

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ========== Alerts ========== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideDown 0.3s ease;
}

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

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: var(--error-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ========== Empty state ========== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

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

.empty-state a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* ========== Filter section ========== */
.filter-section {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

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

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

/* ========== Feedback comments ========== */
.feedback-comments {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 0.75rem;
    border: 1px solid var(--border);
}

.feedback-comments p {
    margin: 0;
    white-space: pre-wrap;
    font-size: 0.9375rem;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 380px;
}

.toast {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.success {
    background: var(--success);
    color: #fff;
}

.toast.error {
    background: var(--error);
    color: #fff;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== Footer ========== */
.main-footer {
    background: var(--surface);
    padding: 1rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar-overlay.visible {
        display: block !important;
        opacity: 1;
        pointer-events: auto;
    }
    
    .sidebar-close {
        display: block;
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .topbar-user .topbar-name {
        display: none;
    }
}

@media (max-width: 768px) {
    .app-content, .container {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.625rem 0.75rem;
    }
    
    .table-wrapper {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Network visualization */
#networkContainer {
    background: var(--surface);
    border-radius: var(--radius-sm);
}

#networkContainer canvas {
    border-radius: var(--radius-sm);
}

/* Print styles */
@media print {
    .sidebar,
    .topbar,
    .menu-toggle,
    .btn,
    .breadcrumb,
    .toast-container {
        display: none !important;
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .app-content {
        padding: 0;
    }
}
