:root {
    --bg-deep: #0f172a;
    --card-bg: #1e293b;
    --accent-primary: #a855f7;
    /* Royal Purple */
    --accent-secondary: #0ea5e9;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #f87171;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.08);
    --sidebar-width: 280px;
    --sidebar-bg: rgba(13, 17, 27, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: radial-gradient(circle at top right, #2e1065, #111827, #020617);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    width: 100%;
    margin: 0;
    overflow: hidden;
}

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 1000;
    border-right: 1px solid var(--glass-border);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 40px;
}

.logo-container i {
    background: linear-gradient(135deg, #a855f7, #60a5fa);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-link.active {
    background: linear-gradient(90deg, #a855f7, #9333ea);
    color: #fff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

/* TOP BAR */
.top-bar {
    height: 80px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 14, 23, 0.4);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
}

.search-section {
    position: relative;
    width: 450px;
}

.search-wrapper i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background: rgba(30, 30, 30, 0.9);
    border: 2px solid #f59e0b;
    border-radius: 50px;
    padding: 12px 25px 12px 55px;
    color: #fff;
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1);
}

.search-input:focus {
    background: rgba(31, 41, 55, 1);
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

/* SEARCH OVERLAY */
.search-results-overlay {
    position: absolute;
    top: 65px;
    left: 10px;
    right: 10px;
    background: rgba(13, 17, 27, 0.95);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 9999;
}

.result-row {
    padding: 12px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.result-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.res-name {
    font-weight: 700;
    color: #fff;
}

.res-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* MAIN VIEWPORT */
.main-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    background: radial-gradient(circle at 50% -20%, rgba(168, 85, 247, 0.15), transparent);
    width: 100%;
    display: flex;
    flex-direction: column;
}

#user-content {
    width: 100%;
    max-width: 100%;
}

/* PROFILE HEADER */
.profile-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 30px 40px;
    display: flex;
    align-items: center;
    gap: 40px;
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease-out;
}

.user-avatar {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    object-fit: cover;
}

.profile-meta h2 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 5px;
    background: linear-gradient(to right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* CARDS & GRID */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

.premium-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--glass-border);
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.4s ease;
}

.premium-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border-color: rgba(168, 85, 247, 0.3);
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.card-title-row span {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.card-title-row i {
    font-size: 1.1rem;
    color: var(--accent-primary);
    background: rgba(168, 85, 247, 0.1);
    padding: 8px;
    border-radius: 8px;
}

/* VERTICAL DATA ROWS */
.data-item-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.data-label-light {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.data-value-bold {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* OUTSTANDING BOX */
.outstanding-box-highlight {
    margin-top: 20px;
    background: rgba(127, 29, 29, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 8px;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.5s ease;
}

#outstanding {
    font-size: 1.8rem !important;
    /* Massive Outstanding */
    color: #fca5a5 !important;
    font-weight: 900;
}

/* BUTTONS */
.btn-blue-pill {
    width: 100%;
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: filter 0.2s;
}

.btn-blue-pill:hover {
    background: #9333ea !important;
}

.btn-premium {
    background: linear-gradient(90deg, #a855f7, #6366f1);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.btn-premium:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

/* ADMIN OVERLAY */
.admin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.admin-modal {
    background: #111827;
    border: 1px solid var(--glass-border);
    border-radius: 36px;
    width: 850px;
    padding: 50px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 20px;
}

.admin-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.admin-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
}

.admin-card i {
    font-size: 2rem;
    color: var(--accent-primary);
    margin-bottom: 15px;
}

/* SPECIAL STATUSES */
#api-amount {
    font-size: 3.2rem !important;
    font-weight: 900;
    text-shadow: 0 0 25px rgba(16, 185, 129, 0.5);
    display: block;
    margin-top: 12px;
    letter-spacing: -2px;
    color: #10b981 !important;
}

/* EDIT MODAL STYLES */
.edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.edit-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
    width: 650px;
    padding: 30px;
    border-radius: 24px;
    border: 1px solid rgba(168, 85, 247, 0.3);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.edit-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.edit-modal-content .search-input {
    padding: 10px 15px;
    font-size: 0.95rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 100%;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* SEARCH CONTROLS & PACS FILTER */
.search-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.search-section {
    width: 650px !important;
}

.search-wrapper {
    flex: 1;
}

.pacs-filter-select {
    background: rgba(30, 30, 30, 0.9);
    border: 2px solid #a855f7;
    border-radius: 50px;
    padding: 10px 20px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 180px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    border-color: #fbbf24;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 80px;
    }

    .logo-container span {
        display: none;
    }

    .nav-link span {
        display: none;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .app-container {
        height: auto;
        overflow-y: visible;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 70px;
        flex-direction: row;
        padding: 0 10px;
        justify-content: space-around;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        background: rgba(13, 17, 27, 0.95);
        backdrop-filter: blur(20px);
    }

    .logo-container {
        display: none;
    }

    .nav-menu {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        gap: 0;
    }

    .nav-link {
        flex-direction: column;
        gap: 4px;
        padding: 8px;
        font-size: 0.7rem;
    }

    .nav-link i {
        font-size: 1.2rem;
    }

    .top-bar {
        padding: 15px;
        height: auto;
        flex-direction: column;
        gap: 15px;
    }

    .search-section {
        width: 100% !important;
    }

    .search-controls {
        flex-direction: column;
    }

    .pacs-filter-select {
        width: 100%;
    }

    .main-viewport {
        padding: 20px 15px 100px 15px;
        /* Extra bottom padding for mobile nav */
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 25px;
        gap: 20px;
    }

    .user-avatar {
        width: 100px;
        height: 100px;
    }

    .profile-meta h2 {
        font-size: 2rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .edit-modal-content,
    .admin-modal {
        width: 95%;
        margin: 10px;
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .edit-form-grid,
    .admin-actions-grid {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    #api-amount {
        font-size: 2.2rem !important;
    }
}

/* TOUCH OPTIMIZATION */
@media (hover: none) {
    .premium-card:hover {
        transform: none;
    }

    .nav-link:active {
        background: rgba(255, 255, 255, 0.1);
    }
}