/* ============================================================================
   HR ZONE — Base Styles
   Root variables, global resets, buttons, modals, tables, cards,
   interactive rows, avatars, status badges, animations, dropdowns, utilities
   ============================================================================ */

/* --- Root Variables & Global --- */
:root {
    --brand-red: #d81f26;
    --brand-red-dark: #b91c22;
    --text-dark: #1a1a1a;
    --text-muted: #555555;
    --bg-light: #f8fafc;
    --bg: #f8fafc;
    --panel: #ffffff;
    --ink: #1a1a1a;
    --muted: #555555;
    --brand: #d81f26;
    --brand-dark: #b91c22;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --header-h: 0px;
    --footer-h: 0px;
}

html, body {
    height: 100%;
    background-color: var(--bg-light);
    overflow-x: hidden;
}

body {
    font-family: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    background: var(--bg);
}

/* Normalize the old spaced uppercase utility look across the portal. */
[class*="uppercase"] {
    text-transform: none !important;
}

[class*="tracking-wide"],
[class*="tracking-wider"],
[class*="tracking-widest"],
[class*="tracking-\["] {
    letter-spacing: normal !important;
}

button {
    border: none;
    font-size: 95%;
}

button.w-10.h-10 {
    width: 2.375rem !important;
    height: 2.375rem !important;
}

button.w-9.h-9 {
    width: 2.1375rem !important;
    height: 2.1375rem !important;
}

button.py-3 {
    padding-top: 0.7125rem !important;
    padding-bottom: 0.7125rem !important;
}

button.py-2 {
    padding-top: 0.475rem !important;
    padding-bottom: 0.475rem !important;
}

button.py-2\.5 {
    padding-top: 0.59375rem !important;
    padding-bottom: 0.59375rem !important;
}

button.px-6 {
    padding-left: 1.425rem !important;
    padding-right: 1.425rem !important;
}

button.px-4 {
    padding-left: 0.95rem !important;
    padding-right: 0.95rem !important;
}

#close-trainer-ranking-modal,
#close-side-modal,
#close-training-details-modal,
#close-assessment-create-btn,
#close-assessment-detail-btn,
#close-profile-details-modal-btn,
#close-add-employee-modal,
#close-profile-picture-modal-btn,
#close-forgot-modal,
#document-rename-close-btn,
#close-profile-modal,
#close-camera-btn,
#add-request-btn,
#header-notification-btn,
#header-profile-button,
#wc-header-profile-button,
#chart-menu-btn,
.close-modal-btn {
    border: none !important;
    box-shadow: none !important;
}

#profile-dropdown button,
#wc-profile-dropdown button,
#chart-options-menu button {
    border: none !important;
    box-shadow: none !important;
}

/* --- Primary Buttons --- */
.btn-primary {
    background-color: var(--brand-red);
    border: none;
    transition: all 0.3s ease;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(216, 31, 38, 0.25);
}

.btn-primary:hover {
    background-color: var(--brand-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(216, 31, 38, 0.3);
}

.btn-primary:disabled {
    background-color: #fca5a5;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* --- Outline Buttons --- */
.btn-outline {
    background: #fff;
    color: var(--brand-red);
    border: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 0 1px rgba(216, 31, 38, 0.2);
}

.btn-outline:hover {
    background: var(--brand-red);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(216, 31, 38, 0.2);
}

/* --- Modals & Overlays --- */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.6);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.dashboard-tab {
    display: none;
}

.dashboard-tab.active {
    display: block;
}

.portal-module-tab.active {
    height: calc(100vh - 73px);
    overflow: hidden;
}

.portal-module-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #f8fafc;
}

.wc-dashboard-tab {
    display: none;
}

.wc-dashboard-tab.active {
    display: block;
}

/* --- Table Styles --- */
thead {
    border-bottom: 2px solid #e5e7eb;
}

table thead th,
table thead th[class*="uppercase"],
table thead th.normal-case,
table thead th[class*="normal-case"] {
    text-transform: uppercase !important;
}

table th,
table td {
    vertical-align: middle;
}

tbody tr {
    border-bottom: 1px solid #f3f4f6;
}

tbody tr:last-child {
    border-bottom: none;
}

.app-table-loading-cell {
    padding: 0 !important;
}

.app-skeleton {
    position: relative;
    overflow: hidden;
    background: #eef2f7;
    border-radius: 0.5rem;
}

.app-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.78), transparent);
    animation: app-skeleton-shimmer 1.25s ease-in-out infinite;
}

.app-skeleton-soft {
    background: #f3f4f6;
}

.app-skeleton-row td {
    padding-top: 0.625rem !important;
    padding-bottom: 0.625rem !important;
}

.app-table-skeleton-bar {
    width: min(100%, var(--app-skeleton-width, 8rem));
    height: 0.75rem;
    max-width: 100%;
}

table.app-table-is-loading {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}

table.app-table-is-loading th,
table.app-table-is-loading td {
    max-width: none !important;
    overflow: hidden !important;
}

.asset-table-wrap.app-table-wrap-is-loading,
.portal-table-wrap.app-table-wrap-is-loading {
    overflow: hidden !important;
}

.asset-list-module:has(table.app-table-is-loading) .asset-table-footer,
.portal-list-module:has(table.app-table-is-loading) .asset-table-footer {
    visibility: hidden;
}

.app-skeleton-card {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1rem;
}

.app-skeleton-stack {
    display: grid;
    gap: 0.75rem;
}

.app-loading-state {
    width: 100%;
    padding: 1rem;
}

.app-loading-panel {
    width: min(100%, 42rem);
    margin: 0 auto;
    display: grid;
    gap: 0.8rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.85rem;
    background: #ffffff;
    padding: 1rem;
}

.portal-module-skeleton .app-loading-panel {
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    align-content: stretch;
}

.portal-module-skeleton .app-loading-message {
    display: none;
}

.portal-module-skeleton .app-loading-panel > .grid {
    height: 100%;
    align-items: stretch;
}

.portal-module-skeleton .app-skeleton-card {
    border-radius: 8px;
    padding: 1.75rem;
    min-height: 0;
}

.portal-module-skeleton .app-loading-panel > .grid > .app-skeleton-card {
    height: 100%;
}

.app-loading-row {
    display: grid;
    grid-template-columns: 2.75rem 1fr;
    gap: 0.8rem;
    align-items: center;
}

.app-loading-lines {
    display: grid;
    gap: 0.45rem;
}

.app-loading-message {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.app-loading-spinner {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    background: #eef2f7;
}

@keyframes app-skeleton-shimmer {
    to {
        transform: translateX(100%);
    }
}

/* --- Card / Panel Styles --- */
.bg-white {
    background: var(--panel) !important;
}

.text-gray-900, .text-gray-800, .text-gray-700 {
    color: var(--ink) !important;
}

.text-gray-600, .text-gray-500 {
    color: var(--muted) !important;
}

.text-gray-400 {
    color: #9ca3af !important;
}

.shadow-md, .shadow, .shadow-sm {
    box-shadow: var(--shadow) !important;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
}

/* --- Interactive Table Rows --- */
.interactive-table-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.interactive-table-row:hover {
    background-color: #fef2f2;
}

.interactive-table-row.selected {
    background-color: #fee2e2;
}

/* --- Textarea Auto-Height --- */
textarea.auto-height {
    resize: none;
    overflow-y: hidden;
}

/* --- User Avatar --- */
.user-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    background-color: var(--brand-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.user-avatar.app-skeleton {
    background: #eef2f7 !important;
    color: transparent !important;
    border: 1px solid #e5e7eb;
}

.profile-header-loading {
    cursor: default;
}

.profile-header-loading:hover {
    opacity: 1 !important;
}

/* --- Status Badges --- */
.status-badge {
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    display: inline-block;
}

.status-New, .status-Processing, .status-Pending_AOD {
    background-color: #e0f2fe;
    color: #0c4a6e;
}

.status-Scheduled {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-Completed {
    background-color: #dcfce7;
    color: #166534;
}

.status-Postponed {
    background-color: #fef9c3;
    color: #854d0e;
}

.status-Cancelled, .status-Rejected {
    background-color: #fee2e2;
    color: #991b1b;
}

/* --- Animations --- */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.03);
        opacity: 0.95;
    }
}

.pulse {
    animation: pulse 1.5s ease-in-out;
}

/* --- Dropdown Menus --- */
.dropdown-menu {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.login-button-text:hover {
    color: var(--brand-red);
    text-decoration: underline;
}

/* --- Progress Bar --- */
.progress-bar-container {
    background-color: #f1f5f9;
    border-radius: 9999px;
    height: 6px;
    overflow: hidden;
}

.progress-bar {
    background-color: var(--brand-red);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}

/* --- Utilities --- */
.visually-hidden {
    position: absolute !important;
    clip: rect(1px,1px,1px,1px);
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- Status Toggle Buttons --- */
.status-toggle-btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    text-transform: capitalize;
    color: #4b5563;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.status-toggle-btn:hover:not(.active) {
    background-color: #e5e7eb;
}

.status-toggle-btn.active {
    background-color: white;
    color: #d81f26;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-weight: 600;
    border: 1px solid #f3f4f6;
}

.status-toggle-btn[data-status="Rejected"].active {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca;
}
