:root {
    --bg-dark: #0f0a17;
    --bg-panel: rgba(30, 20, 45, 0.7);
    --bg-chat-bubble: rgba(69, 42, 102, 0.8);
    --bg-chat-me: #885bc4;
    --text-primary: #f0eaf8;
    --text-secondary: #a89bbd;
    --accent: #b07af0;
    --accent-hover: #c99cfa;
    --border-color: rgba(136, 91, 196, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    background-image: radial-gradient(circle at 20% 30%, rgba(56, 27, 94, 0.4) 0%, transparent 40%),
                      radial-gradient(circle at 80% 70%, rgba(45, 18, 77, 0.4) 0%, transparent 40%);
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    padding: 1rem;
    gap: 1.5rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ==== MAIN PORTFOLIO ==== */
.portfolio-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 2rem;
    border-radius: 24px;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.portfolio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    z-index: 10;
}

.portfolio-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.portfolio-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-right: auto;
    margin-left: 1rem;
    font-weight: 300;
}

.upload-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(136, 91, 196, 0.2);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--accent);
}

.upload-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Gallery Slider */
.gallery-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.gallery-slider {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.slide.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    z-index: 5;
}

.slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.gallery-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(15, 10, 23, 0.6);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    z-index: 10;
    border: 1px solid rgba(255,255,255,0.05);
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.nav-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    color: var(--accent);
}

.slider-indicators {
    display: flex;
    gap: 8px;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.4;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    opacity: 1;
    background: var(--accent);
    transform: scale(1.3);
}

/* Thumbnail Grid */
.gallery-grid {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    min-height: 80px;
}

.thumbnail {
    width: 80px;
    height: 80px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.thumbnail:hover {
    opacity: 0.8;
}

.thumbnail.active {
    opacity: 1;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(176, 122, 240, 0.3);
}


/* ==== RIGHT CHAT SIDEBAR ==== */
.chat-sidebar {
    width: 340px;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 1.5rem;
    position: relative;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 1.1rem;
}

.online-dot {
    width: 8px;
    height: 8px;
    background-color: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px #4ade80;
}

.users-avatars {
    display: flex;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
    margin-left: -8px;
    background-size: cover;
}

.avatar:first-child {
    margin-left: 0;
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding-right: 0.5rem;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 90%;
    animation: fadeIn 0.4s ease forwards;
}

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

.message.friend {
    align-self: flex-start;
}

.message.me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    flex-shrink: 0;
}

.msg-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message.me .msg-content {
    align-items: flex-end;
}

.msg-author {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

.msg-bubble {
    background: var(--bg-chat-bubble);
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
    border-top-left-radius: 4px;
}

.message.me .msg-bubble {
    background: var(--bg-chat-me);
    border-radius: 16px;
    border-top-right-radius: 4px;
}

.msg-time {
    font-size: 0.65rem;
    color: rgba(168, 155, 189, 0.5);
    margin-top: 2px;
}

/* Chat Input */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 1rem;
    background: rgba(15, 10, 23, 0.4);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 20px;
}

.attach-btn, .send-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.attach-btn:hover {
    color: var(--text-primary);
}

.send-btn {
    color: var(--accent);
    background: rgba(176, 122, 240, 0.1);
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.send-btn:hover {
    background: var(--accent);
    color: #fff;
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.chat-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    
    .chat-sidebar {
        width: 100%;
        height: 300px;
    }
}

/* ==== LOGIN SYSTEM ==== */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.login-box {
    background: var(--bg-panel);
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    text-align: center;
    max-width: 400px;
    width: 90%;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.login-box h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}
.login-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 2rem;
}
.login-box input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(15, 10, 23, 0.8);
    border: 1px solid rgba(136, 91, 196, 0.3);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    transition: all 0.3s;
}
.login-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(176, 122, 240, 0.2);
}
.login-box button {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}
.login-box button:hover {
    background: var(--accent-hover);
}
.login-box button:active {
    transform: scale(0.98);
}
.login-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 5px;
    min-height: 20px;
}
