/* Employee Portal - Frontend Styles */

/* ══════════════════════════════════════════════════════════════════
   THEME OVERRIDE — isolate portal from theme styles
   ══════════════════════════════════════════════════════════════════ */
body.em-portal-page {
    margin: 0;
    padding: 0;
    background: #f1f5f9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
}

body.em-portal-login {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

body.em-portal-login .em-portal-body {
    flex: 1;
}

body.em-portal-dash {
    overflow-y: auto;
}

html.em-portal-page {
    overflow-y: auto;
    height: auto;
}

/* Hide any theme elements that leak through wp_head */
body.em-portal-page>*:not(.em-portal-header):not(.em-portal-body):not(.em-portal-footer) {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
}

body.em-portal-page .em-portal-body *,
body.em-portal-page #em-login-wrapper * {
    box-sizing: border-box;
}

/* ── Portal Body ─────────────────────────────────────────────── */
.em-portal-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1e293b;
    background: #f1f5f9;
    box-sizing: border-box;
    padding: 32px 24px 48px;
}

/* ══════════════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════════════ */
.em-portal-header {
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
    height: 65px;
}

.em-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* Logo */
.em-header-left {
    flex-shrink: 0;
}

.em-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.em-logo-img {
    height: 34px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.em-logo-badge {
    display: none;
    font-size: 10px;
    font-weight: 600;
    color: #93c5fd;
    background: rgba(37, 99, 235, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

@media (min-width: 769px) {
    .em-logo-badge {
        display: inline-block;
    }
}

/* Navigation */
.em-header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.em-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.em-nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.em-nav-active,
.em-nav-active:hover {
    background: rgba(37, 99, 235, 0.2);
    color: #93c5fd;
}

/* User pill + logout */
.em-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.em-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 6px 14px 6px 6px;
}

.em-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.em-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.em-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
}

.em-user-role {
    font-size: 11px;
    color: #94a3b8;
}

.em-header-logout {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.em-header-logout:hover {
    background: rgba(220, 38, 38, 0.15);
    color: #fca5a5;
    border-color: rgba(220, 38, 38, 0.3);
}

/* ══════════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════════ */
.em-portal-footer {
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 0 24px;
    box-sizing: border-box;
    height: 65px;
}

.em-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.em-footer-copy {
    font-size: 13px;
    color: #94a3b8;
}

.em-footer-powered {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.em-footer-powered svg {
    opacity: 0.4;
}

/* ══════════════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════════════ */
#em-login-wrapper {
    max-width: 500px;
    margin: 0 auto;
    padding: 24px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}

.em-login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
    padding: 44px 40px;
    border: 1px solid #e2e8f0;
    width: 100%;
}

.em-login-header {
    text-align: center;
    margin-bottom: 32px;
}


.em-login-logo-img {
    height: 88px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.em-login-header h2 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.em-login-header p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

/* ══════════════════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════════════════ */
#em-dashboard-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Welcome Banner ────────────────────────────────────────────── */
.em-welcome-banner {
    background: linear-gradient(135deg, #1a3c84 0%, #2563eb 100%);
    border-radius: 16px;
    padding: 28px 32px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(26, 60, 132, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.em-welcome-text h2 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.em-welcome-text p {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.em-welcome-meta {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.em-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 8px;
    white-space: nowrap;
}

.em-meta-tag svg {
    opacity: 0.7;
}

/* ── Stats Grid ──────────────────────────────────────────────── */
.em-dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.em-dash-stats .em-stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.em-dash-stats .em-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.em-dash-stats .em-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.em-stat-paid::before {
    background: #22c55e;
}

.em-stat-unpaid::before {
    background: #f59e0b;
}

.em-stat-pending::before {
    background: #3b82f6;
}

.em-stat-month::before {
    background: #8b5cf6;
}

.em-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
}

.em-stat-paid .em-stat-icon {
    background: #f0fdf4;
    color: #16a34a;
}

.em-stat-unpaid .em-stat-icon {
    background: #fffbeb;
    color: #d97706;
}

.em-stat-pending .em-stat-icon {
    background: #eff6ff;
    color: #2563eb;
}

.em-stat-month .em-stat-icon {
    background: #f5f3ff;
    color: #7c3aed;
}

.em-dash-stats .em-stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
}

.em-stat-paid .em-stat-value {
    color: #16a34a;
}

.em-stat-unpaid .em-stat-value {
    color: #d97706;
}

.em-stat-pending .em-stat-value {
    color: #2563eb;
}

.em-stat-month .em-stat-value {
    color: #7c3aed;
}

.em-dash-stats .em-stat-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
}

/* ── Two-column grid ─────────────────────────────────────────── */
.em-dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* ── Main Dashboard Layout ───────────────────────────────────── */
/* ── Cards ────────────────────────────────────────────────────── */
.em-dash-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
}

.em-dash-card-full {
    margin-bottom: 0;
}

.em-card-header {
    margin-bottom: 20px;
}

.em-card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.em-card-header h3 svg {
    color: #2563eb;
}

/* ── Forms ────────────────────────────────────────────────────── */
.em-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.em-form-group {
    margin-bottom: 16px;
}

.em-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.em-form-group input[type="email"],
.em-form-group input[type="password"],
.em-form-group input[type="text"],
.em-form-group input[type="date"],
.em-form-group select,
.em-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    color: #1e293b;
    background: #f9fafb;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.em-form-group input:focus,
.em-form-group select:focus,
.em-form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: #fff;
}

.em-form-group textarea {
    resize: vertical;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.em-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    font-family: inherit;
}

.em-btn:active {
    transform: scale(0.97);
}

.em-btn-primary {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.em-btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.em-btn-full {
    width: 100%;
}

.em-btn-lg {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: 12px;
}

.em-btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.em-btn-approve {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.em-btn-approve:hover {
    background: #bbf7d0;
}

.em-btn-reject {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.em-btn-reject:hover {
    background: #fecaca;
}

/* ── Table ────────────────────────────────────────────────────── */
.em-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.em-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
    white-space: nowrap;
}

.em-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.em-table tr:hover td {
    background: #f8fafc;
}

/* ── Status Badges ────────────────────────────────────────────── */
.em-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.em-badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.em-badge-approved {
    background: #d1fae5;
    color: #065f46;
}

.em-badge-rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Policy List ──────────────────────────────────────────────── */
.em-policy-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.em-policy-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}

.em-policy-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.em-dot-green {
    background: #22c55e;
}

.em-dot-amber {
    background: #f59e0b;
}

.em-dot-blue {
    background: #3b82f6;
}

.em-dot-red {
    background: #ef4444;
}

/* ── Alerts ───────────────────────────────────────────────────── */
.em-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.4;
}

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

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

/* ── Empty State ──────────────────────────────────────────────── */
.em-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 14px;
}

.em-empty-state p {
    margin: 12px 0 0;
    color: #94a3b8;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .em-header-nav {
        display: none;
    }

    .em-welcome-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .em-portal-body {
        padding: 20px 16px 40px;
    }

    .em-header-inner {
        padding: 0 16px;
    }

    .em-dash-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .em-form-row {
        grid-template-columns: 1fr 1fr;
    }

    .em-user-info {
        display: none;
    }

    .em-user-pill {
        padding: 4px 4px 4px 4px;
        border-radius: 8px;
    }

    .em-footer-inner {
        flex-direction: column;
        gap: 4px;
        height: auto;
        padding: 12px 0;
    }
}

@media (max-width: 480px) {
    #em-login-wrapper {
        padding: 24px 0;
    }

    .em-login-card {
        padding: 32px 24px;
    }

    .em-dash-stats {
        gap: 10px;
    }

    .em-form-row {
        grid-template-columns: 1fr;
    }

    .em-dash-stats .em-stat-card {
        padding: 16px 12px;
    }

    .em-dash-stats .em-stat-value {
        font-size: 22px;
    }

    .em-welcome-banner {
        padding: 20px;
    }

    .em-welcome-meta {
        flex-direction: column;
        gap: 8px;
    }

    .em-logo-img {
        height: 28px;
    }
}

/* ══════════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════════ */
.em-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.em-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.em-modal-content {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.em-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.em-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.em-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.em-modal-close:hover {
    color: #1e293b;
}