:root {
    --snap-yellow: #FFFC00;
    --snap-ghost: #FFFFFF;
    --text-dark: #000000;
    --text-grey: #666666;
    --bg-grey: #F3F3F3;
    --blue-accent: #0096FF;
    --red-accent: #FF3B30;
    --msg-out: #E6E6E6; /* Light grey for received */
    --msg-in: #0096FF; /* Blue for sent, or maybe Red/Purple depending on preference. Let's go Blue/Red like snapchat status */
    --msg-in-text: #FFFFFF;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: var(--font-stack);
    overflow: hidden; /* Prevent scrolling on body, handle in views */
    background-color: #000; /* Frame background */
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    background: white;
    overflow: hidden;
}

/* --- VIEWS --- */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Hidden by default */
    flex-direction: column;
    background: white;
    transition: transform 0.3s ease-in-out;
}

.view.active {
    display: flex;
    z-index: 10;
    animation: viewFadeIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes viewFadeIn {
    0% { opacity: 0; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

/* --- LOGIN VIEW --- */
#view-login {
    background-color: var(--snap-yellow);
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.ghost-logo {
    font-size: 100px;
    margin-bottom: 20px;
    filter: drop-shadow(0px 4px 10px rgba(0,0,0,0.1));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

#view-login h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 40px;
    color: var(--text-dark);
    letter-spacing: -1px;
}

.input-group {
    width: 100%;
    max-width: 300px;
    margin-bottom: 20px;
    position: relative;
}

#username-input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 25px; /* Pill shape */
    background: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: var(--text-dark);
    outline: none;
    transition: background 0.2s;
}

#username-input:focus {
    background: rgba(255, 255, 255, 0.9);
}

#username-input::placeholder {
    color: rgba(0,0,0,0.4);
}

.btn-primary {
    background-color: var(--red-accent); /* Red button for contrast on yellow */
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: scale(1);
    transition: transform 0.1s;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* --- HEADER --- */
.app-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    backdrop-filter: blur(10px);
    z-index: 20;
}

.app-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--text-dark);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    color: var(--text-dark);
}

/* --- CHAT LIST (ADMIN) --- */
.chat-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-item:active {
    background-color: #f9f9f9;
}

.avatar {
    width: 45px;
    height: 45px;
    background-color: #eee;
    border-radius: 50%;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
}

.chat-preview {
    font-size: 14px;
    color: var(--text-grey);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- CHAT ROOM --- */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: white;
}

.message {
    max-width: 75%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 16px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message.received {
    align-self: flex-start;
    background-color: var(--msg-out); /* Grey */
    color: black;
    border-bottom-left-radius: 4px;
}

.message.sent {
    align-self: flex-end;
    background-color: var(--blue-accent); /* Blue */
    color: white;
    border-bottom-right-radius: 4px;
}
.message-time {
    font-size: 11px;
    margin-left: 8px;
    opacity: 0.7;
    vertical-align: bottom;
    display: inline-block;
}

.message.sent .message-time { color: rgba(255,255,255,0.8); }
.message.received .message-time { color: rgba(0,0,0,0.5); }
.chat-input-area {
    padding: 10px 15px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    z-index: 20;
}

#message-input {
    flex: 1;
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid #eee;
    background: #f9f9f9;
    font-size: 16px;
    outline: none;
}

#message-input:focus {
    border-color: #ddd;
    background: #fff;
}

#send-btn {
    background: none;
    border: none;
    color: var(--blue-accent);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    padding: 5px 10px;
}

#send-btn:disabled {
    color: #ccc;
}

/* Utility */
.icon-btn-small {
    background: none;
    border: none;
    font-size: 20px;
    padding: 5px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn-small:hover {
    background-color: #f0f0f0;
}

.message-img {
    max-width: 100%;
    border-radius: 12px;
    margin-bottom: 5px;
    display: block;
}

.hidden {
    display: none !important;
}

/* --- VIDEO DIRECTORY --- */
#view-video-directory {
    background-color: #111;
    color: white;
    padding: 20px;
    overflow-y: auto;
}

.directory-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.directory-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--snap-yellow);
    flex: 1;
}

.video-file {
    background: #222;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border: 1px solid #333;
    transition: background 0.2s;
}

.video-file:hover {
    background: #333;
}

.video-icon {
    font-size: 24px;
    margin-right: 15px;
}

.video-name {
    font-size: 18px;
    font-weight: 600;
}

.dir-buy-all {
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 12px;
    color: black;
    font-weight: 800;
    font-size: 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    border: 2px solid #FFD700;
    transition: transform 0.1s;
}

.dir-buy-all:active {
    transform: scale(0.98);
}

.video-payment-expand {
    background: #1a1a1a;
    padding: 15px;
    border-radius: 0 0 12px 12px;
    margin-top: -12px; /* Overlap slightly */
    margin-bottom: 15px;
    border: 1px solid #333;
    border-top: none;
    display: none;
    animation: slideDown 0.2s ease-out;
}

.video-payment-expand.active {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* --- INDICATORS --- */
.typing-indicator {
    font-size: 12px;
    color: #999;
    margin-left: 15px;
    margin-bottom: 5px;
    height: 20px;
    font-style: italic;
    opacity: 0;
    transition: opacity 0.3s;
}
.typing-indicator.visible {
    opacity: 1;
}

.eyeball-icon {
    font-size: 16px;
    margin-left: 8px;
    display: none;
    vertical-align: middle;
}
.eyeball-icon.visible {
    display: inline-block;
}

/* --- VIDEO CALL VIEW --- */
#view-video-call {
    background-color: #000 !important;
    z-index: 100; /* Above everything */
}

.video-call-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.remote-feed-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: white;
    flex-direction: column;
    padding: 20px;
    text-align: center;
}

.code-entry-container {
    width: 100%;
    max-width: 300px;
}

.code-entry-container h3 {
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--snap-yellow);
}

.code-entry-container p {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 20px;
}

.code-entry-container input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #333;
    color: white;
    text-align: center;
    font-size: 18px;
    outline: none;
    letter-spacing: 2px;
    transition: border-color 0.2s;
}

.code-entry-container input:focus {
    border-color: var(--snap-yellow);
}

.error-msg {
    color: var(--red-accent);
    margin-top: 15px;
    height: 20px;
    font-size: 14px;
    font-weight: 600;
}

.video-pay-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #333;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.video-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--snap-yellow);
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

#local-video-feed {
    position: absolute;
    bottom: 120px;
    right: 20px;
    width: 100px;
    height: 150px;
    background: #000;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transform: scaleX(-1); /* Mirror effect */
}

.video-controls {
    position: absolute;
    bottom: 40px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 20px;
    z-index: 60; /* Ensure above permission layer */
}

.btn-hangup {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background-color: var(--red-accent);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}

.btn-hangup:active {
    transform: scale(0.9);
}
.permission-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50; /* Above everything except controls if we want controls visible, but let's cover all */
    padding: 30px;
    text-align: center;
}

.permission-layer h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 15px;
}

.permission-layer p {
    color: #aaa;
    margin-bottom: 30px;
    font-size: 16px;
    line-height: 1.5;
}

.btn-grant {
    background-color: var(--snap-yellow);
    color: black;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 252, 0, 0.3);
}

.btn-grant:active {
    transform: scale(0.95);
}
.btn-grant:active {
    transform: scale(0.95);
}

/* --- SETTINGS VIEW --- */
#view-settings {
    background-color: #fff;
}

.settings-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.avatar-large {
    font-size: 80px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

#settings-username {
    margin-bottom: 40px;
    font-size: 24px;
    color: var(--text-dark);
}

.btn-secondary {
    background-color: #eee;
    color: var(--text-dark);
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.1s;
    width: 100%;
    max-width: 300px;
}

.btn-secondary:active {
    transform: scale(0.95);
}

.btn-spacer {
    height: 15px;
}
.btn-spacer {
    height: 15px;
}

/* --- PAYMENT REQUESTS --- */
.pay-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
    min-width: 180px;
}

.btn-pay-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 15px;
    border-radius: 20px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 14px;
    transition: transform 0.1s, opacity 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: white !important;
}

.btn-pay-link:active {
    transform: scale(0.96);
}

.pay-paypal {
    background-color: #0070BA; /* PayPal Blue */
}

.pay-bmc {
    background-color: #FFDD00; /* BMC Yellow */
    color: black !important;
}
.pay-subtext {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-top: 4px;
    font-weight: 500;
}

/* Admin Tools in Input Area */
/* Admin Tools in Input Area */
#admin-tools {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-right: 10px;
    margin-right: 5px;
    border-right: 1px solid #eee;
}

#admin-tools.hidden {
    display: none;
}
/* --- END OF STYLES --- */