/* ============================================================
   KING'S PORTAL - EXECUTIVE ERP THEME (NO FLOATING WIDGETS)
   Palette: Deep Onyx (#120614), Charcoal Panels (#1d0c21), Gold (#D4AF37), Green (#25D366)
   ============================================================ */

:root {
    --erp-bg-dark: #120614;
    --erp-panel-bg: #1d0c21;
    --erp-card-bg: rgba(42, 19, 48, 0.55);
    --erp-border: rgba(255, 245, 238, 0.12);
    --erp-seashell: #FFF5EE;
    --erp-gold: #D4AF37;
    --erp-purple: #452347;
    --erp-purple-light: #5c305f;
    --erp-green: #25D366;
    --erp-cyan: #00BCD4;
    --erp-amber: #FFC107;
    --erp-sidebar-width: 260px;
}

html {
    scroll-behavior: smooth;
}

body.erp-body {
    background-color: var(--erp-bg-dark) !important;
    color: var(--erp-seashell) !important;
    font-family: 'Outfit', 'Readex Pro', system-ui, -apple-system, sans-serif !important;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    box-sizing: border-box;
}

*, *:before, *:after { box-sizing: inherit; }

/* Accessibility & Utilities */
:focus-visible {
    outline: 2px solid var(--erp-gold);
    outline-offset: 2px;
}

::selection {
    background: var(--erp-purple);
    color: var(--erp-gold);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Layout */
.erp-layout {
    display: flex;
    min-height: 100vh;
}

.erp-sidebar {
    width: var(--erp-sidebar-width);
    background: var(--erp-panel-bg);
    border-right: 1px solid var(--erp-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.erp-sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.erp-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.erp-brand-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--erp-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.erp-brand-logo {
    height: 36px;
    width: auto;
}

.erp-brand-tag {
    font-size: 10px;
    font-weight: 700;
    color: var(--erp-gold);
    background: rgba(212,175,55,0.15);
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid rgba(212,175,55,0.3);
    text-transform: uppercase;
}

.erp-nav-menu {
    padding: 20px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.erp-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255,245,238,0.7);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
}

.erp-nav-item:hover, .erp-nav-item.active {
    background: var(--erp-purple);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(69,35,71,0.5);
}

.erp-nav-item i { font-size: 18px; }

.erp-main-content {
    margin-left: var(--erp-sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.erp-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--erp-panel-bg);
    border-bottom: 1px solid var(--erp-border);
    position: sticky;
    top: 0;
    z-index: 90;
}

.erp-mobile-toggle {
    background: transparent;
    border: none;
    color: var(--erp-seashell);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.erp-mobile-toggle:hover {
    opacity: 0.8;
}

.erp-topbar {
    height: 70px;
    background: rgba(29, 12, 33, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--erp-border);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.erp-user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.erp-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--erp-purple);
    color: var(--erp-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid var(--erp-gold);
}

.erp-container {
    padding: 30px;
    max-width: 1300px;
}

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

.erp-card {
    background: var(--erp-card-bg);
    border: 1px solid var(--erp-border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    animation: fadeSlideUp 0.4s ease forwards;
}

.erp-card:hover {
    border-color: rgba(212, 175, 55, 0.3);
    box-shadow: 0 10px 40px rgba(212, 175, 55, 0.1);
}

.erp-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.erp-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
}

.erp-stat-num {
    font-size: 32px;
    font-weight: 800;
    margin-top: 6px;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

.stat-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255,245,238,0.1);
    color: var(--erp-seashell);
}

.lead-box {
    background: var(--erp-panel-bg);
    border: 1px solid var(--erp-border);
    border-radius: 10px;
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.lead-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    border-color: rgba(212, 175, 55, 0.2);
}

.erp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.erp-table th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(255,245,238,0.04);
    color: rgba(255,245,238,0.6);
    font-weight: 600;
    border-bottom: 1px solid var(--erp-border);
}

.erp-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,245,238,0.06);
    color: var(--erp-seashell);
}

.erp-table tr {
    transition: background 0.2s ease;
}

.erp-table tr:hover { background: rgba(255,245,238,0.05); }

.badge-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.badge-new { background: rgba(37,211,102,0.15); color: #25D366; border: 1px solid rgba(37,211,102,0.3); }
.badge-contact { background: rgba(0,188,212,0.15); color: #00BCD4; border: 1px solid rgba(0,188,212,0.3); }
.badge-pending { background: rgba(255,193,7,0.15); color: #FFC107; border: 1px solid rgba(255,193,7,0.3); }
.badge-approved { background: rgba(37,211,102,0.15); color: #25D366; border: 1px solid rgba(37,211,102,0.3); }

.erp-input {
    background: rgba(255,245,238,0.06) !important;
    border: 1px solid var(--erp-border) !important;
    color: var(--erp-seashell) !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    font-family: inherit !important;
    font-size: 13px !important;
    outline: none !important;
    transition: all 0.2s ease;
}

.erp-input:focus {
    border-color: var(--erp-gold) !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3), 0 0 0 3px rgba(212, 175, 55, 0.1) !important;
}

.erp-btn {
    background: linear-gradient(135deg, var(--erp-purple), var(--erp-purple-light));
    color: #fff;
    border: 1px solid rgba(255,245,238,0.2);
    border-radius: 8px;
    padding: 9px 18px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.erp-btn:hover {
    background: linear-gradient(135deg, var(--erp-purple-light), var(--erp-purple));
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
    transform: translateY(-2px);
}

.erp-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(212, 175, 55, 0.1);
}

.erp-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255,245,238,0.5);
    font-size: 14px;
}

/* Card Header Utilities */
.erp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.erp-card-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--erp-seashell);
}

.erp-card-subtitle {
    font-size: 12px;
    color: rgba(255,245,238,0.5);
}

/* Button Variants */
.erp-btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* Text Utilities */
.erp-text-muted {
    opacity: 0.6;
}

/* Photo Gallery Thumbnails */
.erp-photo-thumb {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--erp-border);
    background: #000;
}

.erp-photo-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.erp-drawer-overlay {
    position: fixed;
    top:0; left:0; right:0; bottom:0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.erp-drawer-overlay.active { display: flex; }

.erp-drawer-box {
    background: var(--erp-panel-bg);
    border: 1px solid var(--erp-border);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.erp-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.erp-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.erp-lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 10px;
    border: 2px solid var(--erp-gold);
}

/* Login specific styles - Executive Glassmorphic Overhaul */
@keyframes shimmerBg {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 40px;
    background: radial-gradient(circle at 50% 50%, #432348 0%, #1c0a1f 65%, #0d040e 100%) !important;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .login-wrapper {
        padding: 20px 16px;
    }
}

/* Ambient Glow Orbs - Exact Match to #FEF5EE (light) & #432348 (dark) */
.portal-glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 1;
    opacity: 0.65;
}

.portal-glow-orb.orb-1 {
    width: 550px;
    height: 550px;
    top: -120px;
    right: -100px;
    background: radial-gradient(circle, rgba(67, 35, 72, 0.95) 0%, rgba(67, 35, 72, 0.45) 45%, rgba(13, 4, 14, 0) 75%) !important;
}

.portal-glow-orb.orb-2 {
    width: 650px;
    height: 650px;
    bottom: -180px;
    left: -150px;
    background: radial-gradient(circle, rgba(67, 35, 72, 0.9) 0%, rgba(67, 35, 72, 0.35) 50%, rgba(13, 4, 14, 0) 75%) !important;
}

.portal-glow-orb.orb-3 {
    width: 400px;
    height: 400px;
    top: 45%;
    left: 48%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(254, 245, 238, 0.18) 0%, rgba(254, 245, 238, 0.05) 45%, rgba(0, 0, 0, 0) 75%) !important;
}

/* Top Bar Navigation */
.portal-top-bar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto 20px;
}

.portal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 245, 238, 0.75);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.portal-back-link:hover {
    color: #FFFFFF;
    transform: translateX(-4px);
}

[dir="rtl"] .portal-back-link i {
    transform: rotate(180deg);
}

.portal-lang-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 245, 238, 0.4);
    font-size: 0.85rem;
}

.portal-lang-btn {
    background: transparent;
    border: none;
    color: rgba(255, 245, 238, 0.6);
    font-family: 'Readex Pro', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 2px 6px;
    transition: opacity 0.2s ease;
}

.portal-lang-btn.active {
    color: #FFFFFF;
    font-weight: 700;
}

.portal-lang-btn:hover {
    color: #FFFFFF;
}

/* Main Portal Login Container (Split Layout) */
.portal-login-container {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 60px;
    align-items: center;
    width: 100%;
    max-width: 1160px;
    margin: auto;
    padding: 20px 0;
}

@media (max-width: 960px) {
    .portal-login-container {
        grid-template-columns: 1fr;
        gap: 30px;
        max-width: 460px;
    }

    .portal-brand-panel {
        display: none;
    }
}

/* Left Brand Panel */
.portal-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-emblem-wrapper {
    margin-bottom: 24px;
}

.brand-emblem {
    height: 54px;
    object-fit: contain;
}

.brand-badge {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    color: #D4AF37;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}

.brand-heading {
    font-family: 'Outfit', 'Readex Pro', sans-serif;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    font-weight: 800;
    color: #FFF5EE;
    line-height: 1.15;
    margin: 0 0 16px 0;
}

.brand-subheading {
    font-size: 1.05rem;
    color: rgba(255, 245, 238, 0.75);
    line-height: 1.6;
    margin: 0 0 36px 0;
}

.brand-features-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-badge-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px 20px;
    backdrop-filter: blur(10px);
}

.feature-badge-item .feature-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(69, 35, 71, 0.5);
    border: 1px solid rgba(255, 245, 238, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF5EE;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.feature-badge-item h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #FFF5EE;
    margin: 0 0 4px 0;
}

.feature-badge-item p {
    font-size: 0.85rem;
    color: rgba(255, 245, 238, 0.65);
    margin: 0;
}

/* Right Side: Login Card Box */
.login-card-box {
    background: rgba(26, 11, 29, 0.72) !important;
    border: 1px solid rgba(255, 245, 238, 0.15) !important;
    border-radius: 24px !important;
    padding: 44px 38px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(20px) !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

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

.mobile-brand-logo-wrap {
    margin-bottom: 16px;
}

.login-logo {
    height: 50px;
    object-fit: contain;
}

.login-title {
    font-family: 'Outfit', 'Readex Pro', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    color: #FFFFFF;
    margin: 0 0 6px 0;
}

.login-subtitle {
    font-size: 0.88rem;
    color: rgba(255, 245, 238, 0.65);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.login-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 245, 238, 0.9);
    margin-bottom: 8px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: rgba(255, 245, 238, 0.45);
    font-size: 1.1rem;
    pointer-events: none;
}

[dir="rtl"] .input-icon {
    left: auto;
    right: 16px;
}

.input-with-icon .erp-input {
    width: 100% !important;
    padding: 13px 44px !important;
    background: rgba(12, 4, 14, 0.65) !important;
    border: 1px solid rgba(255, 245, 238, 0.18) !important;
    border-radius: 14px !important;
    color: #FFFFFF !important;
    font-family: 'Readex Pro', sans-serif !important;
    font-size: 0.95rem !important;
    transition: all 0.25s ease !important;
    box-sizing: border-box !important;
}

[dir="rtl"] .input-with-icon .erp-input {
    padding: 13px 44px !important;
}

.input-with-icon .erp-input:focus {
    border-color: rgba(212, 175, 55, 0.6) !important;
    box-shadow: 0 0 16px rgba(69, 35, 71, 0.6), 0 0 6px rgba(212, 175, 55, 0.3) !important;
    background: rgba(12, 4, 14, 0.85) !important;
    outline: none !important;
}

.toggle-password-btn {
    position: absolute;
    right: 14px;
    background: transparent;
    border: none;
    color: rgba(255, 245, 238, 0.5);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

[dir="rtl"] .toggle-password-btn {
    right: auto;
    left: 14px;
}

.toggle-password-btn:hover {
    color: #FFFFFF;
}

.btn-login-submit {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 15px 24px !important;
    margin-top: 10px !important;
    width: 100% !important;
    background: linear-gradient(135deg, #432348 0%, #683070 100%) !important;
    border: 1px solid rgba(254, 245, 238, 0.3) !important;
    border-radius: 14px !important;
    color: #FFFFFF !important;
    font-family: 'Readex Pro', sans-serif !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: 0 8px 24px rgba(67, 35, 72, 0.5) !important;
    transition: all 0.3s ease !important;
}

.btn-login-submit:hover {
    background: linear-gradient(135deg, #592d5c 0%, #833288 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 30px rgba(69, 35, 71, 0.7) !important;
}

.login-security-notice {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 245, 238, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 245, 238, 0.5);
    font-size: 0.78rem;
}

.portal-footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 16px 0 0 0;
    color: rgba(255, 245, 238, 0.45);
    font-size: 0.8rem;
}

/* RTL Support */
[dir="rtl"] .erp-sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--erp-border); }
[dir="rtl"] .erp-main-content { margin-left: 0; margin-right: var(--erp-sidebar-width); }
[dir="rtl"] { text-align: right; }

/* ====== MOBILE RESPONSIVE ====== */
@media (max-width: 768px) {
    .erp-sidebar {
        transform: translateX(-100%);
    }
    .erp-sidebar.mobile-open {
        transform: translateX(0);
    }
    .erp-mobile-header {
        display: flex;
    }
    .erp-main-content {
        margin-left: 0 !important;
    }
    .erp-topbar {
        padding: 12px 16px;
        height: auto;
    }
    .erp-container {
        padding: 16px;
    }
    .erp-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .erp-grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .erp-stat-num {
        font-size: 24px;
    }
    .erp-table {
        font-size: 11px;
    }
    .erp-table th, .erp-table td {
        padding: 8px 10px;
    }
    .erp-card {
        padding: 16px;
    }
    .erp-user-badge {
        gap: 8px;
    }
    .login-card-box {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .erp-grid-4 {
        grid-template-columns: 1fr;
    }
    .erp-topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .erp-user-badge {
        width: 100%;
        justify-content: space-between;
    }
}

/* RTL mobile override */
@media (max-width: 768px) {
    [dir="rtl"] .erp-sidebar {
        transform: translateX(100%);
    }
    [dir="rtl"] .erp-sidebar.mobile-open {
        transform: translateX(0);
    }
    [dir="rtl"] .erp-main-content {
        margin-right: 0 !important;
    }
}
