/* Prevent flash of unstyled content */
html {
    visibility: hidden;
    opacity: 0;
}

html.loaded {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease;
}



/* style.css - Modern Purple Theme with Messaging Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: #0f0b1a;
    color: #f0f0f0;
    line-height: 1.5;
    min-height: 100vh;
}

/* HEADER */
header {
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2d2540;
    background-color: #0f0b1a;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #e2d9ff;
}

header a {
    color: #b19fff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

header a:hover {
    color: #d0c4ff;
}

/* HERO SECTION */
.hero {
    padding: 80px 40px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero h2 {
    font-size: 56px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 24px;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(177, 159, 255, 0.2);
}

.hero p {
    font-size: 20px;
    color: #b8b0d0;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ROLE CARDS */
.role-cards {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 60px;
}

.card {
    flex: 1;
    max-width: 400px;
    padding: 40px;
    background: linear-gradient(145deg, #1a1529, #161125);
    border: 1px solid #3a3155;
    border-radius: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card:hover {
    border-color: #8a7bff;
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(138, 123, 255, 0.25);
}

.card h3 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.8px;
    color: #e2d9ff;
}

.card p {
    color: #b8b0d0;
    font-size: 18px;
    margin-bottom: 24px;
}

.card ul {
    list-style: none;
    margin-top: 24px;
    text-align: left;
}

.card li {
    padding: 8px 0;
    color: #a499cc;
    position: relative;
    padding-left: 24px;
}

.card li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #8a7bff;
    font-weight: bold;
}

/* BUTTONS - PURPLE LIGHT */
button, .submit-btn, .action-btn {
    background: linear-gradient(135deg, #8a7bff, #6a5bff);
    color: #ffffff;
    border: none;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(138, 123, 255, 0.3);
    position: relative;
    overflow: hidden;
}

button:hover, .submit-btn:hover, .action-btn:hover {
    background: linear-gradient(135deg, #9a8bff, #7a6bff);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(138, 123, 255, 0.4);
}

button:active, .submit-btn:active, .action-btn:active {
    transform: translateY(0);
}

.role-cards .card button {
    width: 100%;
    margin-top: 16px;
}

/* HOW IT WORKS */
.how-it-works {
    padding: 80px 40px;
    background: linear-gradient(to bottom, #0f0b1a, #1a1529);
}

.how-it-works h2 {
    font-size: 40px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 60px;
    letter-spacing: -1px;
    color: #e2d9ff;
}

.steps {
    display: flex;
    justify-content: center;
    gap: 60px;
    max-width: 1000px;
    margin: 0 auto;
}

.step {
    flex: 1;
    text-align: center;
}

.step span {
    display: inline-block;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8a7bff, #6a5bff);
    color: #ffffff;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 600;
    line-height: 60px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(138, 123, 255, 0.3);
}

.step p {
    font-size: 18px;
    font-weight: 500;
    color: #d0c4ff;
}

/* FORMS */
.signup-container {
    max-width: 600px;
    margin: 60px auto;
    padding: 0 40px;
}

.signup-form {
    padding: 0;
}

.signup-form h2 {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 40px;
    letter-spacing: -1px;
    color: #e2d9ff;
}

.form-step {
    margin-bottom: 48px;
}

.form-step h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #d0c4ff;
}

input, select, textarea {
    width: 100%;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #3a3155;
    border-radius: 10px;
    font-size: 16px;
    background-color: #1a1529;
    color: #f0f0f0;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #8a7bff;
    box-shadow: 0 0 0 3px rgba(138, 123, 255, 0.2);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* LOGO UPLOAD */
.logo-upload {
    margin-top: 16px;
}

.upload-placeholder {
    width: 120px;
    height: 120px;
    border: 2px dashed #3a3155;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #1a1529;
}

.upload-placeholder:hover {
    border-color: #8a7bff;
    background-color: #211b38;
}

.upload-placeholder span {
    font-size: 32px;
    color: #8a7bff;
}

.upload-placeholder p {
    font-size: 14px;
    color: #b8b0d0;
    margin-top: 8px;
}

/* CATEGORY TAGS */
.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.category-tag {
    padding: 10px 20px;
    border: 1px solid #3a3155;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #1a1529;
    color: #b8b0d0;
}

.category-tag:hover {
    border-color: #8a7bff;
    background-color: #2d2540;
    color: #e2d9ff;
}

.category-tag.selected {
    background-color: #8a7bff;
    color: white;
    border-color: #8a7bff;
}

/* SOCIAL PAGES */
.social-pages-container {
    margin-top: 24px;
}

.social-page-card {
    padding: 24px;
    background: linear-gradient(145deg, #1a1529, #161125);
    border: 1px solid #3a3155;
    border-radius: 12px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.social-page-card:hover {
    border-color: #8a7bff;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h4 {
    font-size: 18px;
    font-weight: 600;
    color: #e2d9ff;
}

.remove-page-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6a5bff;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-page-btn:hover {
    background-color: #2d2540;
    color: #ff7b7b;
}

.price-setting {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.price-setting label {
    font-weight: 500;
    color: #d0c4ff;
}

.price-input {
    max-width: 120px;
    margin-bottom: 0;
}

.currency {
    font-weight: 500;
    color: #8a7bff;
}

.add-page-btn {
    background-color: transparent;
    color: #8a7bff;
    border: 1px solid #3a3155;
    width: 100%;
    margin-top: 20px;
}

.add-page-btn:hover {
    background-color: #2d2540;
    border-color: #8a7bff;
    color: #d0c4ff;
}

/* DASHBOARD */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background-color: #0f0b1a;
}

/* Sidebar */
.sidebar {
    width: 280px;
    border-right: 1px solid #2d2540;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #1a1529, #0f0b1a);
}

.logo h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 40px;
    color: #e2d9ff;
}

.main-nav {
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    text-decoration: none;
    color: #b8b0d0;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background-color: #2d2540;
    color: #e2d9ff;
}

.nav-item.active {
    background: linear-gradient(135deg, #8a7bff, #6a5bff);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(138, 123, 255, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid #2d2540;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #8a7bff, #6a5bff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.user-details {
    flex: 1;
}

.user-details strong {
    display: block;
    font-weight: 600;
    color: #e2d9ff;
}

.user-role {
    font-size: 14px;
    color: #8a7bff;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px;
    background-color: #0f0b1a;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.top-bar h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.8px;
    color: #e2d9ff;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    color: #b8b0d0;
    transition: all 0.3s ease;
}

.notification-btn:hover {
    background-color: #2d2540;
    color: #e2d9ff;
}

.logout-btn {
    background-color: transparent;
    color: #b8b0d0;
    border: 1px solid #3a3155;
}

.logout-btn:hover {
    background-color: #2d2540;
    border-color: #8a7bff;
    color: #e2d9ff;
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 32px;
    background: linear-gradient(145deg, #1a1529, #161125);
    border: 1px solid #3a3155;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #8a7bff;
    transform: translateY(-3px);
}

.stat-card h3 {
    font-size: 16px;
    font-weight: 500;
    color: #b8b0d0;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #8a7bff;
}

/* Dashboard Sections */
.dashboard-section {
    margin-bottom: 48px;
}

.dashboard-section h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #e2d9ff;
}

.activity-list {
    background: linear-gradient(145deg, #1a1529, #161125);
    border: 1px solid #3a3155;
    border-radius: 12px;
    overflow: hidden;
}

.activity-item {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #2d2540;
    color: #b8b0d0;
}

.activity-item:last-child {
    border-bottom: none;
}

.quick-actions {
    display: flex;
    gap: 16px;
}

.action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px;
    font-size: 16px;
    font-weight: 500;
    background: linear-gradient(145deg, #1a1529, #161125);
    border: 1px solid #3a3155;
    transition: all 0.3s ease;
}

.action-btn:hover {
    border-color: #8a7bff;
    transform: translateY(-3px);
}

.action-btn span {
    font-size: 32px;
}

/* FOOTER */
footer {
    padding: 40px;
    text-align: center;
    color: #6a5bff;
    border-top: 1px solid #2d2540;
    margin-top: 80px;
    background-color: #0f0b1a;
}

/* Login Link */
.login-link {
    text-align: center;
    margin-top: 32px;
    color: #b8b0d0;
}

.login-link a {
    color: #8a7bff;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.3s ease;
}

.login-link a:hover {
    color: #d0c4ff;
    text-decoration: underline;
}

/* Two-column layout for dashboard */
.dashboard-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.dashboard-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Welcome message styling */
.welcome-message {
    background: linear-gradient(145deg, #2d2540, #1a1529);
    border: 1px solid #8a7bff;
    padding: 24px;
    border-radius: 12px;
}

.welcome-message h2 {
    color: #8a7bff;
}

/* Empty state for social pages */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(145deg, #1a1529, #161125);
    border: 2px dashed #3a3155;
    border-radius: 12px;
}

.empty-state span {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
    color: #8a7bff;
}

.empty-state h3 {
    color: #e2d9ff;
    margin-bottom: 10px;
}

.empty-state p {
    color: #b8b0d0;
    margin-bottom: 20px;
}

/* Social pages in dashboard */
.social-pages-dashboard {
    margin-top: 20px;
}

.social-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.social-page-card-dashboard {
    padding: 20px;
    background: linear-gradient(145deg, #1a1529, #161125);
    border: 1px solid #3a3155;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.social-page-card-dashboard:hover {
    border-color: #8a7bff;
    transform: translateY(-2px);
}

.social-page-card-dashboard .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.social-page-card-dashboard h4 {
    font-size: 16px;
    color: #e2d9ff;
    margin: 0;
}

.social-page-card-dashboard p {
    margin: 8px 0;
    color: #b8b0d0;
    font-size: 14px;
}

/* ==================== MESSAGES & CONVERSATIONS ==================== */

.messages-container {
    padding: 24px;
    background: #0f0b1a;
}

.conversations-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #3a3155;
}

.conversations-header h2 {
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    background-color: #1a1529;
    border: 1px solid #3a3155;
    border-radius: 8px;
    color: #e2d9ff;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #8a7bff;
    box-shadow: 0 0 0 3px rgba(138, 123, 255, 0.2);
    background-color: #2d2540;
}

/* Conversation cards container */
.conversations-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Enhanced conversation cards */
.conversation-card {
    position: relative;
    border-radius: 12px;
    padding: 16px;
    background-color: #1a1529;
    border: 1px solid #3a3155;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
}

.conversation-card:hover {
    background-color: #2d2540;
    border-color: #8a7bff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(138, 123, 255, 0.15);
}

.conversation-card:active {
    transform: translateY(0);
}

/* Unread conversation styling */
.conversation-card.has-new {
    background-color: #2a2140;
    border-left: 3px solid #8a7bff;
    animation: gentleGlow 2s infinite alternate;
}

@keyframes gentleGlow {
    from {
        box-shadow: 0 4px 15px rgba(138, 123, 255, 0.1);
    }
    to {
        box-shadow: 0 4px 20px rgba(138, 123, 255, 0.2);
    }
}

/* Avatar styling */
.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
    position: relative;
}

.conversation-avatar.business {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.conversation-avatar.promoter {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.conversation-avatar.user {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
}

/* Conversation content */
.conversation-content {
    flex: 1;
    min-width: 0;
}

/* Header with name and timestamp */
.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

/* Conversation name - bold and prominent */
.conversation-name {
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    font-size: 15px;
    letter-spacing: -0.1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.conversation-card.has-new .conversation-name {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(138, 123, 255, 0.3);
}

/* Timestamp - small, colored */
.conversation-time {
    font-size: 11px;
    color: #8a7bff;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 8px;
    flex-shrink: 0;
    background-color: rgba(138, 123, 255, 0.1);
    padding: 3px 8px;
    border-radius: 10px;
    border: 1px solid rgba(138, 123, 255, 0.2);
}

.conversation-card.has-new .conversation-time {
    color: #ff6b8b;
    background-color: rgba(255, 107, 139, 0.1);
    border-color: rgba(255, 107, 139, 0.2);
}

/* Role and company line */
.conversation-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.conversation-role {
    font-size: 12px;
    color: #b8b0d0;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-company {
    font-size: 11px;
    color: #8a7bff;
    font-weight: 500;
    background-color: rgba(138, 123, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(138, 123, 255, 0.2);
}

/* Message preview */
.conversation-preview {
    font-size: 13px;
    color: #a499cc;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.conversation-card.has-new .conversation-preview {
    color: #d0c4ff;
    font-weight: 450;
}

/* Read conversation styling (less prominent) */
.conversation-card:not(.has-new) .conversation-name {
    color: #c9c1e0;
}

.conversation-card:not(.has-new) .conversation-preview {
    color: #8a7bff;
}

.conversation-card:not(.has-new) .conversation-time {
    color: #6b7280;
    background-color: rgba(107, 114, 128, 0.1);
    border-color: rgba(107, 114, 128, 0.2);
}

/* NEW indicator */
.new-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff6b8b, #ff4757);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Message count badge */
.message-count-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #ff6b8b, #ff4757);
    color: white;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid #1a1529;
    box-shadow: 0 2px 8px rgba(255, 107, 139, 0.3);
    padding: 0 4px;
}

/* Loading state */
.loading-conversation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background-color: #1a1529;
    border-radius: 12px;
    border: 1px solid #3a3155;
    animation: pulse 1.5s infinite;
}

.loading-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: #2d2540;
}

.loading-name {
    width: 120px;
    height: 15px;
    background-color: #2d2540;
    border-radius: 4px;
    margin-bottom: 8px;
}

.loading-role {
    width: 80px;
    height: 12px;
    background-color: #2d2540;
    border-radius: 4px;
}

/* Empty state */
.empty-conversations {
    text-align: center;
    padding: 60px 20px;
    color: #b8b0d0;
}

.empty-conversations span {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    color: #8a7bff;
    opacity: 0.7;
}

.empty-conversations h3 {
    color: #e2d9ff;
    margin-bottom: 8px;
    font-size: 18px;
}

.empty-conversations p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .messages-container {
        padding: 16px;
    }
    
    .conversation-card {
        padding: 14px;
        gap: 10px;
    }
    
    .conversation-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .conversation-name {
        font-size: 14px;
        max-width: 150px;
    }
    
    .conversation-role {
        font-size: 11px;
    }
    
    .conversation-preview {
        font-size: 12px;
    }
    
    .conversation-time {
        font-size: 10px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1529;
}

::-webkit-scrollbar-thumb {
    background: #3a3155;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4165;
}

/* Selection Color */
::selection {
    background-color: rgba(138, 123, 255, 0.3);
    color: #ffffff;
}