:root {
    --bg-color: #f0f2f5; 
    --primary-color: #E91E63;
    --secondary-color: #4A148C;
    --app-bg: #FFF5F7;
    --surface-color: #ffffff;
    --surface-light: #FFF3F6;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --shadow-soft: 0 4px 20px rgba(0,0,0,0.04);
    --font-heading: 'Poppins', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; overflow-x: hidden; margin: 0; padding: 0; }
body { min-height: 100svh; background: var(--bg-color); font-family: 'Inter', sans-serif; display: flex; flex-direction: column; }

.app-shell {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: var(--app-bg);
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
    padding-bottom: 90px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

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

/* Utilities */
.container {
    width: 100%;
    padding: 24px;
    /* padding-bottom removed, handled by app-shell */
}

.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.hidden { display: none !important; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
    width: 100%;
    min-height: 44px; /* Touch friendly */
}

.btn-primary {
    background: linear-gradient(135deg, #E91E63, #C2185B);
    color: white;
    box-shadow: var(--shadow-glow);
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    background: var(--surface-color);
    color: var(--secondary-color);
    border: 1px solid rgba(74, 20, 140, 0.2);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

/* Input Fields */
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--secondary-color);
    font-size: 14px;
    font-family: var(--font-heading);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--surface-color);
    border: 1px solid #e5e7eb;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    outline: none;
    min-height: 44px;
}
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}

/* Modal */
.modal-overlay {
    position: absolute; /* Relative to #app */
    inset: 0;
    background: rgba(255, 245, 247, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-content {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-glow);
    border: 1px solid rgba(233, 30, 99, 0.2);
}

/* Intent Selection Cards */
.intent-card {
    background: var(--surface-color);
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    transition: all 0.2s;
}
.intent-card.selected {
    border-color: var(--primary-color);
    background: rgba(233, 30, 99, 0.05);
}
.intent-icon { color: var(--primary-color); }

/* Multi-select Tags */
.tags-container { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: var(--surface-light);
    color: var(--secondary-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.tag.selected {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Layout Elements */
.header-top {
    padding: 16px 24px;
    background: var(--app-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0; margin: 0 auto;
    width: 100%; max-width: 480px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(233, 30, 99, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 24px 0; /* extra padding for safe area */
    box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
    z-index: 100;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}
.nav-item.active { color: var(--primary-color); font-weight: 500; }
.nav-item i { width: 24px; height: 24px; }

/* Profile Cards (Home) */
.home-section {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
}
.list-profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
}
.list-profile-card:last-child { border-bottom: none; padding-bottom: 0; }
.avatar-container { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-light);
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.online-dot {
    position: absolute;
    bottom: 2px; right: 2px;
    width: 14px; height: 14px;
    background: var(--success-color);
    border: 2px solid white;
    border-radius: 50%;
}
.list-profile-info { flex: 1; }
.list-profile-info h4 { margin-bottom: 4px; font-size: 16px; }
.list-profile-info p { color: var(--text-secondary); font-size: 13px; }

/* Detail Profile Card */
.profile-cover {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

/* Chat UI */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--app-bg);
}
.chat-header {
    background: var(--surface-color);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 10;
}
.chat-banner {
    background: rgba(74, 20, 140, 0.05);
    color: var(--secondary-color);
    text-align: center;
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 15px;
    position: relative;
}
.msg-sent {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}
.msg-received {
    align-self: flex-start;
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid rgba(0,0,0,0.05);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.msg-timestamp {
    display: block; font-size: 10px; margin-top: 4px; opacity: 0.7; text-align: right;
}

.chat-input {
    background: var(--surface-color);
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
}
.chat-input input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-pill);
    padding: 12px 20px;
    font-size: 15px;
    outline: none;
    background: #f9fafb;
}
.chat-input input:focus { border-color: var(--primary-color); }
.chat-input button {
    background: linear-gradient(135deg, #E91E63, #C2185B);
    color: white;
    border: none;
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
}

/* Admin Dashboard Specifics */
.admin-container {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.admin-sidebar {
    width: 100%;
    background: var(--surface-color);
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex; flex-direction: column;
}

.admin-nav { display: flex; flex-direction: row; gap: 8px; margin-top: 16px; overflow-x: auto; }
.admin-nav a {
    padding: 10px 16px; border-radius: var(--radius-md); white-space: nowrap;
    color: var(--text-secondary); display: flex; align-items: center; gap: 8px;
    font-weight: 500; font-size: 13px;
}
.admin-nav a.active {
    background: rgba(233, 30, 99, 0.1); color: var(--primary-color);
}

.admin-content {
    flex: 1; padding: 16px; overflow-y: auto;
}

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface-color); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-soft); }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid #f3f4f6; }
th { background: #f9fafb; color: var(--text-secondary); font-size: 13px; text-transform: uppercase; }

.tabs { display: flex; gap: 12px; margin-bottom: 24px; }
.tab {
    padding: 12px 24px; background: white; border-radius: var(--radius-pill);
    cursor: pointer; font-weight: 500; color: var(--text-secondary);
    border: 1px solid #e5e7eb;
}
.tab.active {
    background: var(--primary-color); color: white; border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

/* Inboxes */
.inboxes-container { display: flex; flex-direction: column; gap: 24px; height: auto; }
.conversation-list { background: white; border-radius: var(--radius-lg); overflow-y: auto; box-shadow: var(--shadow-soft); border: 1px solid #f3f4f6; }
.conversation-item { padding: 16px; border-bottom: 1px solid #f3f4f6; cursor: pointer; transition: background 0.2s; }
.conversation-item:hover, .conversation-item.active { background: rgba(74, 20, 140, 0.05); }

/* Global Footer */
#global-footer {
    padding: 24px; text-align: center; color: var(--text-secondary); font-size: 12px;
    margin-bottom: 60px; /* Above Bottom Nav */
}
.footer-links a { color: var(--secondary-color); margin: 0 4px; }

/* Skeleton Loaders */
@keyframes shimmer {
    0% { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}
.skeleton {
    background: #f6f7f8;
    background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-repeat: no-repeat;
    background-size: 800px 100%; 
    animation-duration: 1.5s;
    animation-fill-mode: forwards; 
    animation-iteration-count: infinite;
    animation-name: shimmer;
    animation-timing-function: linear;
    border-radius: 4px;
}
.skeleton-text { height: 12px; margin-bottom: 8px; width: 100%; }
.skeleton-text.short { width: 60%; }
.skeleton-avatar { width: 44px; height: 44px; border-radius: 50%; }

/* Logout Modal */
#logout-modal .modal-content {
    background: white; border-radius: var(--radius-lg); padding: 24px;
    width: 90%; max-width: 320px; text-align: center;
}

/* Chat Input Bottom Nav Safe Area */
.chat-input-wrapper {
    position: sticky;
    bottom: 60px; /* Buffer for bottom nav */
    background: var(--surface-color);
    padding: 12px 16px;
    border-top: 1px solid rgba(0,0,0,0.05);
    z-index: 50;
}
.chat-container {
    height: calc(100vh - 60px); /* Leave room for bottom nav */
}

.flex-column { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
