/* =============================================================================
   THE CORE — Client Portal CSS (IT Paradise Theme)
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Backgrounds & Surfaces */
    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 50%, #e0f2fe 100%);
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
    
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-hover: rgba(255, 255, 255, 0.9);
    
    /* Branding */
    --primary:      #6366f1;
    --primary-glow: rgba(99,102,241,0.25);
    --purple:       #8b5cf6;
    --success:      #10b981;
    --warning:      #f59e0b;
    --danger:       #ef4444;
    --info:         #0ea5e9;

    /* Text */
    --text:         #1e293b; /* Slate 800 */
    --text-2:       #475569; /* Slate 600 */
    --text-3:       #64748b; /* Slate 500 */

    --radius:       12px;
    --radius-lg:    24px;
    --font:         'Plus Jakarta Sans', sans-serif;
}

html { font-size: 14.5px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg-gradient);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Decorative Background Blobs */
.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
}
.blob-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: #bfdbfe; }
.blob-2 { bottom: -20%; right: -10%; width: 60vw; height: 60vw; background: #e9d5ff; }
.blob-3 { top: 40%; left: 30%; width: 40vw; height: 40vw; background: #fed7aa; opacity: 0.4; }

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ── Main Glass Layout ─────────────────────────────────────────────────────── */
.portal-app {
    display: flex;
    width: 100%;
    max-width: 1400px;
    height: calc(100vh - 48px);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.portal-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 32px 24px;
    border-right: 1px solid rgba(255,255,255,0.3);
}

.portal-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 48px;
}
.portal-logo-mark {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.portal-logo-text {
    font-size: 1.1rem;
    color: var(--text);
    font-weight: 800;
    letter-spacing: -0.3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.pnav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-2);
    text-decoration: none;
    transition: all 0.2s ease;
}
.pnav-link svg { color: var(--text-3); transition: color 0.2s; }

.pnav-link:hover, .pnav-link.active {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}
.pnav-link:hover svg, .pnav-link.active svg { color: var(--primary); }

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* User profile in sidebar */
.portal-user-profile {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.pu-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pu-name { font-weight: 700; font-size: 0.85rem; color: var(--text); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.pu-email { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ffffff;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Main Content Area ─────────────────────────────────────────────────────── */
.portal-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 40px;
    position: relative;
}

/* Header inside main content */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.5px;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.pbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    font-family: var(--font);
}
.pbtn-primary {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #fff;
    box-shadow: 0 4px 16px var(--primary-glow);
}
.pbtn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}
.pbtn-outline {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.pbtn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.pbtn-danger {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
}
.pbtn-danger:hover {
    background: var(--danger);
    color: #fff;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.portal-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}
.portal-card:hover {
    background: var(--card-hover);
    box-shadow: 0 8px 30px rgba(0,0,0,0.04);
}

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

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.pform-group { margin-bottom: 20px; }
.pform-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-2);
}
.pform-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--text);
    transition: all 0.2s ease;
}
.pform-control:focus {
    outline: none;
    background: rgba(255,255,255,0.9);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}
.pform-control::placeholder { color: var(--text-3); opacity: 0.7; }
textarea.pform-control { resize: vertical; min-height: 120px; }

select.pform-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ── Badges ────────────────────────────────────────────────────────────────── */
.pbadge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pbadge-success { background: rgba(16,185,129,0.15); color: #059669; }
.pbadge-warning { background: rgba(245,158,11,0.15); color: #d97706; }
.pbadge-primary { background: var(--primary-glow); color: var(--primary); }
.pbadge-neutral { background: rgba(0,0,0,0.05); color: var(--text-2); }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.ptable-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
}
.ptable {
    width: 100%;
    border-collapse: collapse;
}
.ptable th {
    background: rgba(255,255,255,0.4);
    padding: 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.ptable td {
    padding: 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    color: var(--text);
}
.ptable tr:last-child td { border-bottom: none; }
.ptable tr:hover td { background: rgba(255,255,255,0.4); }

/* ── Flash Messages ────────────────────────────────────────────────────────── */
.portal-flash {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    animation: slideIn 0.3s ease forwards;
}
@keyframes slideIn { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }
.portal-flash-success { background: rgba(16,185,129,0.1); color: #059669; border: 1px solid rgba(16,185,129,0.2); }
.portal-flash-error   { background: rgba(239,68,68,0.1); color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }

/* Generic Alert (Auth pages) */
.portal-alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}
.portal-alert-error { background: rgba(239,68,68,0.1); color: #dc2626; border: 1px solid rgba(239,68,68,0.2); }

/* ── Auth / Login Pages ────────────────────────────────────────────────────── */
.portal-login-page {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.portal-login-box {
    width: 100%;
    max-width: 440px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--glass-shadow);
}
.login-title { font-size: 1.75rem; font-weight: 800; color: var(--text); margin-bottom: 8px; text-align: center; letter-spacing:-0.5px; }
.login-sub { color: var(--text-2); font-size: 0.95rem; text-align: center; margin-bottom: 32px; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .portal-app { height: auto; min-height: calc(100vh - 48px); flex-direction: column; }
    .portal-sidebar { width: 100%; padding: 20px; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.3); flex-direction: row; align-items: center; flex-wrap: wrap; }
    .portal-logo { margin-bottom: 0; }
    .sidebar-nav { flex-direction: row; margin-left: auto; align-items: center; gap: 4px; }
    .pnav-link { padding: 8px 12px; }
    .pnav-link span { display: none; } /* hide text on mobile */
    .sidebar-footer { margin-top: 0; padding-top: 0; margin-left: 20px; flex-direction: row; align-items: center; }
    .portal-user-profile { display: none; } /* hide user profile box on mobile nav */
    .portal-main { padding: 24px; }
}

@media (max-width: 600px) {
    body { padding: 0; }
    .portal-app { border-radius: 0; min-height: 100vh; border: none; }
    .bg-blobs { display: none; } /* improve performance on small screens */
    .sidebar-nav { width: 100%; justify-content: space-between; margin-top: 16px; margin-left: 0; }
    .sidebar-footer { margin-left: auto; }
}
