/* ============================================
   Danavictory Social - CSS v2.0
   Mobile App-Like Design
   Compatible PHP 5.4+
   ============================================ */

/* ============== CSS VARIABLES ============== */
:root {
    --pink: #FF4FA3;
    --blue: #4F8CFF;
    --orange: #FF9F43;
    --green: #10B981;
    --purple: #8B5CF6;
    --red: #EF4444;
    
    /* Light Theme (Default) */
    --bg: #FFFFFF;
    --bg2: #F5F5F7;
    --bg3: #E5E7EB;
    --text: #181818;
    --text2: #6B7280;
    --text3: #9CA3AF;
    --border: #E5E7EB;
    
    /* Gradients */
    --gradient: linear-gradient(135deg, var(--pink), var(--blue), var(--orange));
    --gradient-pink: linear-gradient(135deg, var(--pink), var(--orange));
    --gradient-blue: linear-gradient(135deg, var(--blue), var(--green));
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    
    /* Safe Areas for PWA */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

/* Dark Mode */
body.dark {
    --bg: #121212;
    --bg2: #1E1E1E;
    --bg3: #2C2C2C;
    --text: #F5F5F5;
    --text2: #A0A0A0;
    --text3: #6B6B6B;
    --border: #333333;
}

/* ============== RESET & BASE ============== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============== UTILITY CLASSES ============== */
.hidden { display: none !important; }
.sr-only { 
    position: absolute; 
    width: 1px; 
    height: 1px; 
    overflow: hidden; 
    clip: rect(0,0,0,0); 
}

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============== SPLASH SCREEN ============== */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s, visibility 0.5s;
}

.splash-screen.hide {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-logo {
    margin-bottom: 16px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: bold;
    animation: pulse 1.5s ease-in-out infinite;
}

.splash-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 4px;
}

.splash-subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 32px;
}

.splash-loader {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ============== APP CONTAINER ============== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============== HEADER ============== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.dark .app-header {
    background: rgba(18,18,18,0.92);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-d {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    position: relative;
    transition: background 0.15s;
}

.header-btn:hover {
    background: var(--bg2);
}

.header-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--red);
    color: white;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-badge {
    padding: 4px 10px;
    background: var(--orange);
    color: white;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ============== MAIN CONTENT ============== */
.main-content {
    flex: 1;
    padding-bottom: 80px;
    overflow-x: hidden;
}

.view-active {
    animation: fadeInUp 0.3s ease-out;
}

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

/* ============== HOME VIEW ============== */

/* Hero Section */
.hero-section {
    position: relative;
    padding: 32px 20px;
    text-align: center;
    overflow: hidden;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient);
    opacity: 0.95;
}

.hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
    position: relative;
    z-index: 1;
    color: white;
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
}

.hero-subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 28px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.hero-note {
    font-size: 14px;
    opacity: 0.85;
}

.demo-link {
    color: white;
    font-weight: 700;
    text-decoration: underline;
}

/* Features Section */
.features-section {
    padding: 28px 16px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.section-title i {
    color: var(--pink);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.feature-card {
    background: var(--bg);
    padding: 20px 16px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    margin: 0 auto 14px;
}

.feature-card:nth-child(1) .feature-icon { background: linear-gradient(135deg, #FF4FA3, #FF69B4); }
.feature-card:nth-child(2) .feature-icon { background: linear-gradient(135deg, #4F8CFF, #06B6D4); }
.feature-card:nth-child(3) .feature-icon { background: linear-gradient(135deg, #FF9F43, #FBBF24); }
.feature-card:nth-child(4) .feature-icon { background: linear-gradient(135deg, #10B981, #34D399); }

.feature-card h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.feature-card p {
    font-size: 13px;
    color: var(--text2);
    line-height: 1.5;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 24px 16px;
    background: var(--bg2);
    margin: 0 16px;
    border-radius: 16px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: var(--pink);
}

.stat-label {
    font-size: 11px;
    color: var(--text2);
    font-weight: 500;
}

/* How It Works Section */
.how-section {
    padding: 28px 16px;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.step-content p {
    font-size: 13px;
    color: var(--text2);
}

/* PWA Banner */
.pwa-banner {
    position: fixed;
    bottom: 90px;
    left: 16px;
    right: 16px;
    z-index: 999;
    padding: 16px;
    background: var(--gradient);
    border-radius: 20px;
    color: white;
    animation: slideUpBanner 0.4s ease-out;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.pwa-banner-text {
    flex: 1;
}

.pwa-banner-text strong {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

.pwa-banner-text p {
    font-size: 13px;
    opacity: 0.9;
}

.pwa-banner-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

@keyframes slideUpBanner {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============== FEED VIEW ============== */

/* Stories Container */
.stories-container {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.stories-wrapper {
    display: flex;
    gap: 16px;
    padding: 0 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.stories-wrapper::-webkit-scrollbar {
    display: none;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.story-avatar {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    padding: 3px;
    background: var(--border);
    position: relative;
}

.story-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.story-ring::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid var(--gradient);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.story-add {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.story-name {
    font-size: 12px;
    color: var(--text2);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Post Composer */
.post-composer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.composer-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.composer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.composer-input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg2);
    border-radius: 22px;
    font-size: 14px;
    color: var(--text2);
    cursor: pointer;
    transition: background 0.15s;
}

.composer-input:hover {
    background: var(--bg3);
}

.composer-actions {
    display: flex;
    gap: 8px;
}

.composer-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.composer-btn:hover {
    background: var(--bg2);
}

/* Posts Feed */
.posts-feed {
    display: flex;
    flex-direction: column;
}

.post-card {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 12px;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-size: 15px;
    font-weight: 600;
}

.post-time {
    font-size: 13px;
    color: var(--text3);
}

.post-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.post-menu-btn:hover {
    background: var(--bg2);
}

.post-content {
    padding: 0 16px 12px;
    font-size: 15px;
    line-height: 1.5;
}

.post-image {
    margin: 0 16px 12px;
    border-radius: 12px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
}

.post-stats {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text2);
}

.post-stats strong {
    color: var(--text);
}

.post-actions {
    display: flex;
    padding: 8px 16px 12px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: 10px;
    color: var(--text2);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.action-btn:hover {
    background: var(--bg2);
}

.action-btn.like-btn.liked,
.action-btn.like-btn.liked i {
    color: var(--pink);
}

.action-btn.bookmark-btn.bookmarked,
.action-btn.bookmark-btn.bookmarked i {
    color: var(--orange);
}

/* Comments Section */
.comments-section {
    padding: 12px 16px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.comment-item {
    display: flex;
    gap: 10px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
}

.comment-text {
    font-size: 14px;
    margin-top: 2px;
}

.comment-input-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.comment-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.comment-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============== EXPLORE VIEW ============== */

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg2);
    margin: 12px 16px;
    border-radius: 14px;
}

.search-icon {
    color: var(--text3);
    font-size: 16px;
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--text);
}

.search-input::placeholder {
    color: var(--text3);
}

.search-clear {
    color: var(--text3);
    padding: 4px;
}

/* Trending Section */
.trending-section {
    padding: 20px 16px;
}

.subsection-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.subsection-title i {
    color: var(--pink);
}

.trending-list {
    display: flex;
    flex-direction: column;
}

.trending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.trending-item:last-child {
    border-bottom: none;
}

.trending-category {
    font-size: 12px;
    color: var(--pink);
    font-weight: 600;
}

.trending-topic {
    font-size: 16px;
    font-weight: 600;
    margin: 2px 0;
}

.trending-posts {
    font-size: 13px;
    color: var(--text3);
}

/* Suggested Users */
.suggested-section {
    padding: 0 16px 20px;
}

.suggested-users {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-suggest-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg2);
    border-radius: 14px;
}

.suggest-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.suggest-info {
    flex: 1;
    min-width: 0;
}

.suggest-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.suggest-handle {
    font-size: 12px;
    color: var(--text3);
}

/* Photo Grid */
.explore-grid {
    padding: 0 16px 20px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

.grid-photo {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
}

.grid-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s;
}

.grid-photo:hover img {
    transform: scale(1.05);
}

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 10px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.grid-photo:hover .photo-overlay {
    opacity: 1;
}

/* ============== CHAT VIEW ============== */
.chat-list {
    display: flex;
    flex-direction: column;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}

.chat-item:hover,
.chat-item.active {
    background: var(--bg2);
}

.chat-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-avatar-wrap img {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
}

.group-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--gradient-pink);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--green);
    border-radius: 50%;
    border: 2px solid var(--bg);
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-name {
    font-size: 15px;
    font-weight: 600;
}

.chat-time {
    font-size: 12px;
    color: var(--text3);
}

.chat-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-preview {
    font-size: 14px;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.unread-badge {
    padding: 3px 9px;
    background: var(--pink);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Chat Window */
.chat-window {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.chat-window-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.back-chat-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.chat-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-with-name {
    font-size: 16px;
    font-weight: 600;
}

.chat-user-status {
    font-size: 12px;
    color: var(--green);
}

.chat-options-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
}

.message.received {
    align-self: flex-start;
    background: var(--bg2);
    border-bottom-left-radius: 4px;
}

.message.sent {
    align-self: flex-end;
    background: var(--gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content {
    font-size: 14px;
    line-height: 1.4;
}

.message-time {
    display: block;
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.message.sent .message-time {
    text-align: right;
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.chat-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--pink);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-message-input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg2);
    border: none;
    border-radius: 22px;
    outline: none;
    font-size: 14px;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============== NOTIFICATIONS VIEW ============== */
.notif-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 16px 0;
}

.notif-tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg2);
    color: var(--text2);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.notif-tab.active {
    background: var(--gradient);
    color: white;
}

.notifications-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg2);
    border-radius: 14px;
    border-left: 3px solid transparent;
}

.notif-item.unread {
    border-left-color: var(--pink);
}

.notif-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-size: 16px;
}

.notif-icon.like { background: var(--pink); }
.notif-icon.comment { background: var(--blue); }
.notif-icon.follow { background: var(--green); }
.notif-icon.mention { background: var(--purple); }
.notif-icon.share { background: var(--orange); }
.notif-icon.system { background: var(--text3); }

.notif-content {
    flex: 1;
    min-width: 0;
}

.notif-content p {
    font-size: 14px;
    line-height: 1.4;
}

.notif-time {
    font-size: 12px;
    color: var(--text3);
    margin-top: 2px;
    display: block;
}

.notif-preview {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

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

/* ============== PROFILE VIEW ============== */
.profile-header {
    position: relative;
}

.cover-photo {
    height: 140px;
    background: var(--gradient-blue);
    position: relative;
}

.cover-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, var(--bg));
}

.profile-info-section {
    position: relative;
    margin-top: -50px;
    padding: 0 16px;
    text-align: center;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--bg);
    margin: 0 auto 12px;
    position: relative;
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.online-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: var(--green);
    border-radius: 50%;
    border: 3px solid var(--bg);
}

.profile-name {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 4px;
}

.profile-handle {
    font-size: 14px;
    color: var(--text2);
    margin-bottom: 10px;
}

.profile-bio {
    font-size: 14px;
    color: var(--text2);
    line-height: 1.5;
    margin-bottom: 12px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 16px;
}

.profile-meta a {
    color: var(--blue);
}

.profile-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.profile-stat-item {
    text-align: center;
}

.profile-stat-item strong {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

.profile-stat-item span {
    font-size: 12px;
    color: var(--text3);
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.profile-tab {
    flex: 1;
    padding: 14px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text2);
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.profile-tab.active {
    color: var(--pink);
    border-bottom-color: var(--pink);
}

.profile-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.profile-post-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
}

.profile-post-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-post-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-post-item:hover .profile-post-overlay {
    opacity: 1;
}

/* ============== SETTINGS VIEW ============== */
.settings-section {
    padding: 20px 16px;
}

.settings-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-left: 4px;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg2);
    border-radius: 14px;
    margin-bottom: 8px;
}

.setting-item.clickable {
    cursor: pointer;
    transition: background 0.15s;
}

.setting-item.clickable:hover {
    background: var(--bg3);
}

.setting-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.setting-info {
    flex: 1;
    min-width: 0;
}

.setting-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.setting-desc {
    font-size: 13px;
    color: var(--text3);
    margin-top: 2px;
}

.setting-arrow {
    color: var(--text3);
    font-size: 14px;
}

.settings-footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--text3);
    font-size: 13px;
}

.settings-footer p {
    margin-bottom: 4px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg3);
    border-radius: 30px;
    transition: background 0.25s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    transition: transform 0.25s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--green);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ============== BOTTOM NAVIGATION ============== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
}

.dark .bottom-nav {
    background: rgba(18,18,18,0.95);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    color: var(--text3);
    font-size: 11px;
    font-weight: 500;
    position: relative;
    transition: color 0.15s;
}

.nav-item i {
    font-size: 22px;
}

.nav-item.active {
    color: var(--pink);
}

.nav-item:hover {
    color: var(--pink);
}

.nav-center-btn {
    position: relative;
    top: -8px;
}

.nav-center-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--gradient);
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(255,79,163,0.4);
}

.nav-badge {
    position: absolute;
    top: 2px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--red);
    color: white;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg);
}

/* ============== MODALS ============== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-sm {
    max-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--pink);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text2);
    font-size: 20px;
    transition: background 0.15s;
}

.modal-close:hover {
    background: var(--bg3);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.modal-footer p {
    font-size: 14px;
    color: var(--text2);
}

.modal-footer a {
    color: var(--blue);
    font-weight: 600;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg2);
    border: 2px solid transparent;
    border-radius: 12px;
    outline: none;
    font-size: 15px;
    color: var(--text);
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--pink);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text2);
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--pink);
}

.form-link {
    font-size: 14px;
    color: var(--blue);
    font-weight: 500;
}

/* Post Composer Modal */
.post-form-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.post-form-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.post-form-header span {
    font-weight: 600;
}

.post-textarea {
    width: 100%;
    padding: 14px;
    background: var(--bg2);
    border: none;
    border-radius: 14px;
    resize: none;
    outline: none;
    font-size: 15px;
    min-height: 120px;
    color: var(--text);
    font-family: inherit;
}

.post-image-preview {
    position: relative;
    margin-bottom: 12px;
    border-radius: 14px;
    overflow: hidden;
}

.post-image-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.post-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.post-form-tools {
    display: flex;
    gap: 8px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--pink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.15s;
}

.tool-btn:hover {
    background: var(--bg2);
}

/* Story Viewer */
.story-viewer {
    width: 100%;
    max-width: 420px;
    height: 90vh;
    max-height: 750px;
    background: var(--bg);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.story-viewer-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top));
}

.story-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.3);
    z-index: 11;
}

.story-progress {
    height: 100%;
    background: white;
    width: 0%;
    animation: storyProgress 10s linear forwards;
}

@keyframes storyProgress {
    from { width: 0%; }
    to { width: 100%; }
}

.story-viewer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    position: relative;
    z-index: 10;
}

.story-viewer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.story-viewer-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.story-viewer-time {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    margin-left: auto;
}

.story-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 12;
}

.story-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.story-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    z-index: 10;
    cursor: pointer;
}

.story-nav.prev {
    left: 0;
}

.story-nav.next {
    right: 0;
}

.story-reply {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    z-index: 10;
}

.story-reply-input {
    flex: 1;
    padding: 10px 16px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 22px;
    outline: none;
    color: white;
    font-size: 14px;
}

.story-reply-input::placeholder {
    color: rgba(255,255,255,0.5);
}

.story-reply-btn {
    color: white;
    font-size: 18px;
    padding: 8px;
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.search-overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
}

.search-overlay-header i {
    color: var(--text3);
    font-size: 18px;
}

.search-overlay-header input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 16px;
}

.search-cancel-btn {
    color: var(--pink);
    font-weight: 600;
    font-size: 15px;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.search-empty {
    text-align: center;
    color: var(--text3);
    padding: 40px 20px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 14px 24px;
    background: #181818;
    color: white;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out forwards;
    pointer-events: auto;
}

.toast.toast-out {
    animation: toastOut 0.3s ease-out forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ============== BUTTONS ============== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--gradient);
    color: white;
}

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

.btn-outline:hover {
    border-color: var(--pink);
    color: var(--pink);
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-white {
    background: white;
    color: var(--pink);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 17px;
    border-radius: 16px;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 10px;
}

.btn-follow {
    padding: 8px 18px;
    background: var(--blue);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ============== RESPONSIVE DESIGN ============== */

/* Tablet */
@media (min-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .stats-section {
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-title {
        font-size: 42px;
    }
    
    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .profile-posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .modal-content {
        border-radius: 20px;
    }
    
    .modal-overlay {
        align-items: center;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .app-container {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: var(--shadow-lg);
    }
    
    .bottom-nav,
    .app-header {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .bottom-nav {
        width: 480px;
    }
    
    .pwa-banner {
        max-width: 468px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Small phones */
@media (max-width: 380px) {
    .hero-title {
        font-size: 26px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .profile-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
