:root {
    --bg-color: #1a1a2e;
    --box-bg: #16213e;
    --text-main: #ffffff;
    --text-dim: #8b8b9f;
    --accent-green: #2ecc71;
    --accent-red: #e74c3c;
    
    /* Theme Gradients */
    --login-grad: linear-gradient(135deg, #11998e, #38ef7d);
    --signup-grad: linear-gradient(135deg, #008080, #8a2be2);
    --file-grad: linear-gradient(135deg, #00c6ff, #0072ff);
    
    /* 3D Shadows */
    --outset-shadow: 6px 6px 14px rgba(0,0,0,0.5), -4px -4px 10px rgba(255,255,255,0.03);
    --inset-shadow: inset 6px 6px 12px rgba(0,0,0,0.6), inset -5px -5px 10px rgba(255,255,255,0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    background-color: var(--bg-color);
    color: var(--text-main);
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Adapts better to mobile browser toolbars */
    overflow: hidden; /* Prevents entire page from scrolling */
}

/* Views & Layout */
.view-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 20px; 
    max-width: 500px;
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* 3D Outset Elements */
.3d-box {
    background: var(--box-bg);
    border-radius: 24px;
    box-shadow: var(--outset-shadow);
    padding: 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 3D Inset Container (For Transfer and Network) */
.inset-box {
    background: var(--bg-color);
    border-radius: 24px;
    box-shadow: var(--inset-shadow);
    padding: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-size: 16px;
    color: var(--text-dim);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding-left: 5px;
}

/* Inputs */
.inset-input {
    width: 100%;
    padding: 18px 20px;
    background: var(--box-bg);
    border: none;
    border-radius: 16px;
    color: var(--text-main);
    font-size: 16px;
    box-shadow: var(--inset-shadow);
    outline: none;
    transition: all 0.3s ease;
}

.inset-input::placeholder {
    color: #555566;
}

/* Div Buttons */
.btn {
    padding: 16px;
    border-radius: 16px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--outset-shadow);
    transition: all 0.1s ease;
}

.btn:active {
    box-shadow: var(--inset-shadow);
    transform: scale(0.97);
}

/* Auth Specific */
.auth-box {
    margin: auto; /* Centers perfectly vertically and horizontally in view container */
}

.brand-title {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    background: var(--login-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-bottom: 10px;
}

.auth-tabs {
    display: flex;
    background: var(--bg-color);
    border-radius: 16px;
    padding: 6px;
    box-shadow: var(--inset-shadow);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-dim);
    font-weight: bold;
    transition: 0.3s;
}

.tab.active {
    color: var(--text-main);
    box-shadow: var(--outset-shadow);
}

.theme-login .tab.active { background: var(--login-grad); }
.theme-login #btn-login { background: var(--login-grad); }
.theme-signup .brand-title {
    background: var(--signup-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.theme-signup .tab.active { background: var(--signup-grad); }
.theme-signup #btn-signup { background: var(--signup-grad); }

.form-section { display: none; flex-direction: column; gap: 20px; }
.form-section.active-form { display: flex; animation: fadeIn 0.3s ease; }

/* Header */
.header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    flex-shrink: 0;
}

.username-text {
    font-size: 18px;
    font-weight: 700;
}

.logout-btn {
    padding: 10px 20px;
    background: var(--accent-red);
    font-size: 14px;
}

.file-btn {
    background: var(--file-grad);
}

/* File Preview Box */
.preview-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    background: var(--box-bg);
    border-radius: 16px;
    box-shadow: var(--outset-shadow);
    animation: fadeIn 0.3s ease;
}

.preview-visual {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--bg-color);
    box-shadow: var(--inset-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: bold;
    color: var(--file-grad);
    font-size: 12px;
    flex-shrink: 0;
}

.preview-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.preview-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-size {
    font-size: 12px;
    color: var(--text-dim);
}

/* Users Section & Scrollable List */
.users-section {
    flex: 1; /* Takes up remaining height perfectly */
    overflow: hidden; /* Contains inner scroll */
}

.users-list {
    flex: 1;
    overflow-y: auto; /* Allows scrolling only inside this list */
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 5px; /* Room for shadows */
    /* Hide Scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.users-list::-webkit-scrollbar {
    display: none;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-radius: 16px;
    background: var(--box-bg);
    box-shadow: var(--outset-shadow);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.user-row:active {
    box-shadow: var(--inset-shadow);
    transform: scale(0.98);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px; /* Perfect gap between dot and name */
    font-weight: 600;
    font-size: 16px;
}

.last-seen-text {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 500;
    margin-left: 10px; /* Gap between username and offline msg */
}

/* Status Dots */
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--accent-green);
}

/* Custom Toasts (Now positioned at bottom) */
#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: var(--box-bg);
    color: var(--text-main);
    padding: 14px 24px;
    border-radius: 24px;
    box-shadow: var(--outset-shadow);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    animation: slideUp 0.3s ease forwards;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

