/*
Theme Name: Meet2Drink Social
Theme URI: https://meet2drink.com
Author: Meet2Drink Team
Description: Rețea socială pentru întâlniri la un pahar
Version: 3.0.0
Requires at least: 5.0
Requires PHP: 7.4
License: GPL v2 or later
Text Domain: meet2drink
*/

:root {
    --m2d-bg: #000000;
    --m2d-bg-card: #121212;
    --m2d-bg-input: #262626;
    --m2d-bg-hover: #1a1a1a;
    --m2d-primary: #ff6b35;
    --m2d-primary-dark: #e55a2b;
    --m2d-secondary: #833ab4;
    --m2d-success: #22c55e;
    --m2d-danger: #ef4444;
    --m2d-warning: #f59e0b;
    --m2d-info: #0095f6;
    --m2d-text: #ffffff;
    --m2d-text-secondary: #a8a8a8;
    --m2d-text-muted: #8e8e8e;
    --m2d-border: #262626;
    --m2d-radius: 16px;
    --m2d-radius-sm: 12px;
    --m2d-shadow: 0 10px 40px rgba(0,0,0,0.5);
    --m2d-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--m2d-bg);
    color: var(--m2d-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; height: auto; }

/* ============================================
   LAYOUT
============================================ */
.m2d-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 60px;
}

.m2d-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--m2d-bg);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--m2d-border);
    min-height: 52px;
}

.m2d-logo {
    font-size: 1.5rem;
    font-weight: 400;
    font-family: 'Billabong', cursive, -apple-system, sans-serif;
    color: var(--m2d-text);
    letter-spacing: 1px;
}

.m2d-header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.m2d-header-btn {
    width: 24px;
    height: 24px;
    color: var(--m2d-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    background: none;
    border-radius: 0;
}

.m2d-header-btn:hover { opacity: 0.7; }

.m2d-header-btn svg { width: 24px; height: 24px; }

.m2d-header-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff3040;
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.m2d-header-btn:hover { background: var(--m2d-bg-input); color: var(--m2d-text); }
.m2d-header-btn img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

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

.m2d-main {
    flex: 1;
    padding: 12px;
    padding-top: 8px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 480px) {
    .m2d-main {
        padding: 8px;
        padding-top: 4px;
    }
    
    .m2d-app {
        padding-bottom: 75px;
    }
}

/* Search Panel */
.m2d-search-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--m2d-bg);
    z-index: 10001;
    display: none;
    flex-direction: column;
}

.m2d-search-panel.open {
    display: flex;
}

.m2d-search-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--m2d-border);
}

.m2d-search-panel-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--m2d-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.m2d-search-panel-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--m2d-bg-input);
    border: 1px solid var(--m2d-border);
    border-radius: 24px;
    color: var(--m2d-text);
    font-size: 1rem;
}

.m2d-search-panel-input:focus {
    outline: none;
    border-color: var(--m2d-primary);
}

.m2d-search-panel-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.m2d-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    transition: background 0.2s;
}

.m2d-search-result:hover {
    background: var(--m2d-bg-hover);
}

.m2d-search-result img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.m2d-search-result span {
    font-weight: 500;
}

/* ============================================
   BOTTOM NAVIGATION
============================================ */
.m2d-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--m2d-bg);
    border-top: 1px solid var(--m2d-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 1000;
}

.m2d-nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    color: var(--m2d-text);
    transition: opacity 0.2s;
    position: relative;
    background: none;
    border: none;
}

.m2d-nav-item svg { width: 26px; height: 26px; }
.m2d-nav-item:active { opacity: 0.5; }

.m2d-nav-create {
    border: 1px solid var(--m2d-border);
    border-radius: 8px;
    padding: 6px 12px;
}

.m2d-nav-profile img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    object-fit: cover;
}

.m2d-nav-profile.active img,
.m2d-nav-item.active .m2d-nav-profile img {
    border-color: var(--m2d-text);
}

/* ============================================
   STORIES
============================================ */
.m2d-stories {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--m2d-border);
}
.m2d-stories::-webkit-scrollbar { display: none; }

.m2d-story {
    flex-shrink: 0;
    text-align: center;
    width: 70px;
}

.m2d-story-ring {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    padding: 3px;
    background: var(--m2d-gradient);
    margin: 0 auto 6px;
}

.m2d-story-ring.no-story {
    background: var(--m2d-border);
}

.m2d-story-ring img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--m2d-bg);
    object-fit: cover;
}

.m2d-story-add {
    position: relative;
}

.m2d-story-add .m2d-story-ring {
    background: none;
    border: 1px solid var(--m2d-border);
}

.m2d-story-add-btn {
    position: absolute;
    bottom: 8px;
    right: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--m2d-info);
    color: white;
    border: 2px solid var(--m2d-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
}

.m2d-story-name {
    font-size: 0.7rem;
    color: var(--m2d-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   FAB - Hidden (using nav now)
============================================ */
.m2d-fab {
    display: none;
}

/* ============================================
   CARDS - Swipe System
============================================ */
.m2d-cards {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: 3/4;
    perspective: 1000px;
}

.m2d-card {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--m2d-radius);
    overflow: hidden;
    background: var(--m2d-bg-card);
    box-shadow: var(--m2d-shadow);
    transition: transform 0.3s ease;
    cursor: grab;
    user-select: none;
}

.m2d-card:active { cursor: grabbing; }
.m2d-card[data-index="0"] { z-index: 3; }
.m2d-card[data-index="1"] { z-index: 2; transform: scale(0.95) translateY(10px); opacity: 0.7; }
.m2d-card[data-index="2"] { z-index: 1; transform: scale(0.9) translateY(20px); opacity: 0.4; }

.m2d-card-image {
    position: absolute;
    inset: 0;
}

.m2d-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.m2d-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, rgba(0,0,0,0.9));
}

.m2d-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 1;
}

.m2d-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.m2d-tag {
    padding: 6px 12px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.m2d-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.m2d-card-location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--m2d-text-secondary);
    font-size: 0.9rem;
}

.m2d-card-host {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
}

.m2d-card-host img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.m2d-card-host-name { font-weight: 500; }
.m2d-card-host-label { font-size: 0.75rem; color: var(--m2d-text-muted); }

.m2d-swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 800;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.m2d-swipe-indicator.like { right: 20px; background: var(--m2d-success); }
.m2d-swipe-indicator.nope { left: 20px; background: var(--m2d-danger); }
.m2d-card.swiping-right .m2d-swipe-indicator.like,
.m2d-card.swiping-left .m2d-swipe-indicator.nope { opacity: 1; }

.m2d-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding: 0 16px;
}

.m2d-action-btn {
    flex: 1;
    max-width: 200px;
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: var(--m2d-bg-card);
    color: var(--m2d-text);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-weight: 600;
    font-size: 0.95rem;
}

.m2d-action-btn:hover { transform: scale(1.02); }
.m2d-action-btn.skip { 
    background: var(--m2d-bg-card);
    color: var(--m2d-text-secondary);
    border: 1px solid var(--m2d-border);
}
.m2d-action-btn.skip:hover { 
    background: var(--m2d-bg-hover); 
    color: var(--m2d-text);
}
.m2d-action-btn.join { 
    background: linear-gradient(135deg, var(--m2d-primary), var(--m2d-secondary));
    color: white;
}
.m2d-action-btn.join:hover { 
    opacity: 0.9;
}

/* ============================================
   FEED & POSTS
============================================ */
.m2d-feed { display: flex; flex-direction: column; gap: 16px; }

.m2d-post {
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius);
    overflow: hidden;
}

.m2d-post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.m2d-post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

.m2d-post-info { flex: 1; }
.m2d-post-author { font-weight: 600; cursor: pointer; }
.m2d-post-author:hover { color: var(--m2d-primary); }
.m2d-post-time { font-size: 0.8rem; color: var(--m2d-text-muted); }

.m2d-post-menu {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--m2d-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.m2d-post-menu:hover { background: var(--m2d-bg-input); }

.m2d-post-content {
    padding: 0 16px 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.m2d-post-media {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    cursor: pointer;
}

.m2d-post-media-video {
    width: 100%;
    max-height: 500px;
    background: black;
}

.m2d-post-stats {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    color: var(--m2d-text-muted);
    font-size: 0.85rem;
}

.m2d-post-actions {
    display: flex;
    border-top: 1px solid var(--m2d-border);
}

.m2d-post-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: var(--m2d-text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.m2d-post-action:hover { background: var(--m2d-bg-input); }
.m2d-post-action.liked { color: var(--m2d-danger); }
.m2d-post-action svg { width: 20px; height: 20px; }

/* Comments */
.m2d-comments {
    border-top: 1px solid var(--m2d-border);
    padding: 12px 16px;
    display: none;
}

.m2d-comments.show { display: block; }

.m2d-comment {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.m2d-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.m2d-comment-content,
.m2d-comment-body {
    flex: 1;
    background: var(--m2d-bg-input);
    padding: 10px 14px;
    border-radius: 18px;
}

.m2d-comment-author {
    font-weight: 600;
    font-size: 0.9rem;
}

.m2d-comment-text {
    font-size: 0.9rem;
    margin-top: 2px;
}

.m2d-comment-body .m2d-comment-time {
    margin-left: 0;
    margin-top: 6px;
}

.m2d-comment-time {
    font-size: 0.75rem;
    color: var(--m2d-text-muted);
    margin-top: 4px;
    margin-left: 46px;
}

.m2d-comment-form {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--m2d-border);
}

.m2d-comment-form input,
.m2d-comment-form .comment-input {
    flex: 1;
    padding: 10px 16px;
    background: var(--m2d-bg-input);
    border: 1px solid var(--m2d-border);
    border-radius: 24px;
    color: var(--m2d-text);
    font-size: 0.9rem;
}

.m2d-comment-form input:focus,
.m2d-comment-form .comment-input:focus { 
    outline: none; 
    border-color: var(--m2d-primary);
}

.m2d-comment-form button,
.m2d-comment-form .comment-submit-btn {
    padding: 10px 20px;
    background: var(--m2d-primary);
    color: white;
    border-radius: 24px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.m2d-comment-form button:hover,
.m2d-comment-form .comment-submit-btn:hover {
    background: var(--m2d-primary-dark);
}

.m2d-comment-form button:disabled,
.m2d-comment-form .comment-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Create Post */
.m2d-create-post {
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.m2d-create-post-top {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.m2d-create-post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.m2d-create-post-input {
    flex: 1;
    background: var(--m2d-bg-input);
    border: none;
    border-radius: var(--m2d-radius-sm);
    padding: 12px 16px;
    color: var(--m2d-text);
    font-size: 1rem;
    resize: none;
    min-height: 60px;
    font-family: inherit;
}

.m2d-create-post-input:focus { outline: none; }
.m2d-create-post-input::placeholder { color: var(--m2d-text-muted); }

.m2d-create-post-preview {
    margin-top: 12px;
    position: relative;
    display: none;
}

.m2d-create-post-preview.show { display: block; }

.m2d-create-post-preview img,
.m2d-create-post-preview video {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--m2d-radius-sm);
}

.m2d-create-post-preview .remove-media {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.m2d-create-post-btns {
    display: flex;
    gap: 8px;
}

.m2d-create-post-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--m2d-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.m2d-create-post-btn:hover { background: var(--m2d-bg-input); color: var(--m2d-primary); }
.m2d-create-post-btn input { display: none; }

/* ============================================
   PROFILE PAGE
============================================ */
.m2d-profile {
    max-width: 600px;
    margin: 0 auto;
}

.m2d-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    position: sticky;
    top: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.m2d-profile-header h1 { font-size: 1.125rem; font-weight: 600; }

.m2d-profile-header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--m2d-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.m2d-profile-cover {
    height: 120px;
    background: linear-gradient(135deg, var(--m2d-primary), var(--m2d-secondary));
    position: relative;
    overflow: hidden;
}

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

.m2d-profile-cover-edit {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.m2d-profile-cover-edit:hover {
    background: rgba(0,0,0,0.8);
}

.m2d-profile-cover-edit input {
    display: none;
}

/* Avatar Container - separat de cover */
.m2d-profile-avatar-container {
    display: flex;
    justify-content: center;
    margin-top: -40px;
    position: relative;
    z-index: 20;
}

.m2d-profile-avatar-wrap {
    position: relative;
    display: inline-block;
}

.m2d-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--m2d-bg);
    object-fit: cover;
    background: var(--m2d-bg-card);
    display: block;
}

.m2d-profile-avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--m2d-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 3px solid var(--m2d-bg);
    z-index: 25;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
}

.m2d-profile-avatar-edit:hover {
    background: #ff8a5b;
    transform: scale(1.1);
}

.m2d-profile-avatar-edit svg {
    width: 16px;
    height: 16px;
}

.m2d-profile-avatar-edit input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    top: 0;
    left: 0;
}

.m2d-profile-info {
    padding: 16px 16px 20px;
    text-align: center;
}

/* Rank System */
.m2d-profile-rank {
    margin-top: 16px;
    padding: 16px;
    background: var(--m2d-bg-input);
    border-radius: var(--m2d-radius-sm);
}

.m2d-rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.m2d-rank-icon {
    font-size: 1.1rem;
}

.m2d-rank-title {
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.m2d-rank-details {
    margin-top: 12px;
}

.m2d-rank-points {
    font-weight: 600;
    color: var(--m2d-text);
}

.m2d-rank-progress-wrap {
    height: 6px;
    background: var(--m2d-border);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.m2d-rank-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--m2d-primary), var(--m2d-secondary));
    border-radius: 3px;
    transition: width 0.3s;
}

.m2d-rank-next {
    font-size: 0.8rem;
    color: var(--m2d-text-muted);
    margin-top: 6px;
}

.m2d-rating-display {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.m2d-rating-stars {
    font-size: 1rem;
}

.m2d-rating-value {
    font-weight: 700;
    color: var(--m2d-text);
}

.m2d-rating-count {
    font-size: 0.85rem;
    color: var(--m2d-text-muted);
}

.m2d-profile-name {
    font-size: 1.5rem;
    font-weight: 700;
}

.m2d-profile-username {
    color: var(--m2d-text-muted);
    font-size: 0.9rem;
}

.m2d-profile-bio {
    margin-top: 12px;
    line-height: 1.6;
}

.m2d-profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    color: var(--m2d-text-secondary);
    font-size: 0.9rem;
}

.m2d-profile-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.m2d-profile-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--m2d-border);
}

.m2d-profile-stat {
    text-align: center;
    cursor: pointer;
}

.m2d-profile-stat:hover strong {
    color: var(--m2d-primary);
}

.m2d-profile-stat strong {
    display: block;
    font-size: 1.25rem;
    color: var(--m2d-text);
    transition: color 0.2s;
}

.m2d-profile-stat span {
    font-size: 0.8rem;
    color: var(--m2d-text-muted);
}

.m2d-profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

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

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

.m2d-profile-tab:hover { color: var(--m2d-text); }
.m2d-profile-tab.active { color: var(--m2d-primary); border-bottom-color: var(--m2d-primary); }

.m2d-profile-content { padding: 16px; }

/* Photo Grid */
.m2d-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

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

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

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

.m2d-photo-slot {
    aspect-ratio: 1;
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius-sm);
    overflow: hidden;
    position: relative;
}

.m2d-photo-slot.main { grid-column: span 2; grid-row: span 2; }
.m2d-photo-slot img { width: 100%; height: 100%; object-fit: cover; }

.m2d-photo-slot .delete-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;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
}

.m2d-photo-slot:hover .delete-btn { opacity: 1; }

.m2d-photo-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--m2d-text-muted);
    cursor: pointer;
    border: 2px dashed var(--m2d-border);
    border-radius: var(--m2d-radius-sm);
    gap: 4px;
    font-size: 0.75rem;
    padding: 8px;
    transition: all 0.2s;
}

.m2d-photo-add:hover { border-color: var(--m2d-primary); color: var(--m2d-primary); }
.m2d-photo-add input { display: none; }

/* Friends List */
.m2d-friends-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.m2d-friend-card {
    background: var(--m2d-bg-input);
    border-radius: var(--m2d-radius-sm);
    padding: 16px;
    text-align: center;
}

.m2d-friend-card img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
}

.m2d-friend-card h4 { font-size: 0.95rem; font-weight: 600; }

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

.m2d-btn-primary {
    background: linear-gradient(135deg, var(--m2d-primary), #ff8f5a);
    color: white;
}

.m2d-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
}

.m2d-btn-secondary { background: var(--m2d-bg-input); color: var(--m2d-text); }
.m2d-btn-secondary:hover { background: var(--m2d-border); }

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

.m2d-btn-outline:hover { background: var(--m2d-primary); color: white; }

.m2d-btn-success { background: var(--m2d-success); color: white; }
.m2d-btn-danger { background: var(--m2d-danger); color: white; }
.m2d-btn-block { width: 100%; }
.m2d-btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.m2d-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============================================
   FORMS
============================================ */
.m2d-form-group { margin-bottom: 16px; }
.m2d-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--m2d-text-secondary); margin-bottom: 8px; }

.m2d-input,
.m2d-textarea,
.m2d-select {
    width: 100%;
    padding: 14px 16px;
    background: var(--m2d-bg-input);
    border: 1px solid var(--m2d-border);
    border-radius: var(--m2d-radius-sm);
    color: var(--m2d-text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.m2d-input:focus, .m2d-textarea:focus, .m2d-select:focus { outline: none; border-color: var(--m2d-primary); }
.m2d-input::placeholder, .m2d-textarea::placeholder { color: var(--m2d-text-muted); }
.m2d-textarea { resize: vertical; min-height: 100px; }

.m2d-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 44px;
}

.m2d-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.m2d-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--m2d-text-secondary);
    cursor: pointer;
}

.m2d-checkbox input { width: 20px; height: 20px; accent-color: var(--m2d-primary); }

.m2d-form-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--m2d-danger);
    padding: 12px 16px;
    border-radius: var(--m2d-radius-sm);
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: none;
}

.m2d-form-error.show { display: block; }

/* ============================================
   MODAL
============================================ */
.m2d-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

.m2d-modal {
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius);
    width: 100%;
    max-width: 450px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s;
}

@media (max-height: 700px) { .m2d-modal { max-height: 95vh; } }

.m2d-modal-overlay.open .m2d-modal { transform: translateY(0); }

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

.m2d-modal-title { font-size: 1.25rem; font-weight: 700; }

.m2d-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--m2d-bg-input);
    color: var(--m2d-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.m2d-modal-close:hover { background: var(--m2d-border); color: var(--m2d-text); }

.m2d-modal form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.m2d-modal-body,
.m2d-modal form .m2d-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    min-height: 0;
}

.m2d-modal-footer {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid var(--m2d-border);
    background: var(--m2d-bg-card);
}

.m2d-modal-footer .m2d-btn { flex: 1; }

/* ============================================
   CHAT PANEL
============================================ */
.m2d-chat-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 380px;
    height: 500px;
    max-height: 70vh;
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius) var(--m2d-radius) 0 0;
    box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.m2d-chat-panel.open { transform: translateY(0); }

.m2d-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--m2d-border);
    flex-shrink: 0;
}

.m2d-chat-back {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--m2d-text-muted);
    display: none;
    align-items: center;
    justify-content: center;
}

.m2d-chat-back.show { display: flex; }
.m2d-chat-back:not(.hidden) { display: flex; }
.m2d-chat-back.hidden { display: none; }
.m2d-chat-title { flex: 1; font-weight: 600; }

/* Chat Tabs */
.m2d-chat-tabs {
    display: flex;
    border-bottom: 1px solid var(--m2d-border);
    flex-shrink: 0;
    background: var(--m2d-bg-card);
}

.m2d-chat-tabs.hidden { display: none; }

.m2d-chat-tab {
    flex: 1;
    padding: 12px 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--m2d-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.m2d-chat-tab:hover { color: var(--m2d-text-secondary); background: var(--m2d-bg-hover); }
.m2d-chat-tab.active { color: var(--m2d-primary); border-bottom-color: var(--m2d-primary); background: transparent; }

.m2d-chat-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--m2d-text);
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--m2d-bg-input);
    flex-shrink: 0;
}

.m2d-chat-back:not(.hidden) { display: flex; }
.m2d-chat-back.hidden { display: none; }

.m2d-chat-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--m2d-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.m2d-chat-close:hover { background: var(--m2d-bg-input); color: var(--m2d-text); }

.m2d-chat-content { flex: 1; overflow-y: auto; }

.m2d-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.m2d-conv-item:hover { background: var(--m2d-bg-input); }

.m2d-conv-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.m2d-conv-info { flex: 1; min-width: 0; }
.m2d-conv-name { font-weight: 600; margin-bottom: 2px; }
.m2d-conv-preview { font-size: 0.875rem; color: var(--m2d-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m2d-conv-unread { background: var(--m2d-primary); color: white; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }

.m2d-messages { display: flex; flex-direction: column; gap: 8px; padding: 16px; }

.m2d-message {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.938rem;
}

.m2d-message.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--m2d-primary), #ff8f5a);
    color: white;
    border-bottom-right-radius: 4px;
}

.m2d-message.other {
    align-self: flex-start;
    background: var(--m2d-bg-input);
    border-bottom-left-radius: 4px;
}

.m2d-message-user {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--m2d-primary);
}

.m2d-chat-input-wrap {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--m2d-border);
    flex-shrink: 0;
}

.m2d-chat-input-wrap input {
    flex: 1;
    padding: 12px 16px;
    background: var(--m2d-bg-input);
    border: none;
    border-radius: 24px;
    color: var(--m2d-text);
    font-size: 0.938rem;
}

.m2d-chat-input-wrap input:focus { outline: none; }

.m2d-chat-input-wrap button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--m2d-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.m2d-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--m2d-text-muted);
}

.m2d-empty-state-icon { font-size: 3rem; margin-bottom: 12px; }

/* ============================================
   AUTH PAGES
============================================ */
.m2d-auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--m2d-bg);
}

.m2d-auth-container { 
    width: 100%; 
    max-width: 400px;
    margin: auto;
}

.m2d-auth-logo { text-align: center; margin-bottom: 32px; }

.m2d-auth-logo h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--m2d-primary), var(--m2d-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.m2d-auth-logo p { color: var(--m2d-text-muted); margin-top: 8px; }

.m2d-auth-card {
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius);
    padding: 32px;
}

.m2d-auth-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 24px; }
.m2d-auth-footer { text-align: center; margin-top: 24px; color: var(--m2d-text-muted); }
.m2d-auth-footer a { color: var(--m2d-primary); font-weight: 600; }

.m2d-auth-back {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--m2d-text-muted);
    font-size: 0.875rem;
    z-index: 10;
}

@media (max-height: 700px) {
    .m2d-auth-page {
        align-items: flex-start;
        padding-top: 60px;
    }
    
    .m2d-auth-logo {
        margin-bottom: 20px;
    }
    
    .m2d-auth-card {
        padding: 24px;
    }
}

/* ============================================
   TOASTS
============================================ */
.m2d-toasts {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.m2d-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius-sm);
    box-shadow: var(--m2d-shadow);
    animation: slideIn 0.3s ease;
    max-width: 320px;
}

.m2d-toast.success { border-left: 4px solid var(--m2d-success); }
.m2d-toast.error { border-left: 4px solid var(--m2d-danger); }

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

/* ============================================
   NOTIFICATIONS PANEL
============================================ */
.m2d-notif-panel {
    position: fixed;
    top: 60px;
    right: 16px;
    width: 360px;
    max-height: 70vh;
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius);
    box-shadow: var(--m2d-shadow);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.m2d-notif-panel.open { display: flex; }

.m2d-notif-header {
    padding: 16px;
    border-bottom: 1px solid var(--m2d-border);
    font-weight: 600;
}

.m2d-notif-list { flex: 1; overflow-y: auto; }

.m2d-notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.m2d-notif-item:hover { background: var(--m2d-bg-input); }
.m2d-notif-item.unread { background: rgba(255, 107, 53, 0.05); }

.m2d-notif-avatar,
.m2d-notif-item img { 
    width: 44px; 
    height: 44px; 
    border-radius: 50%; 
    object-fit: cover;
    flex-shrink: 0;
}

.m2d-notif-item-content { flex: 1; min-width: 0; }
.m2d-notif-item-text { font-size: 0.9rem; line-height: 1.4; }
.m2d-notif-item-time { font-size: 0.8rem; color: var(--m2d-text-muted); margin-top: 4px; }

.m2d-notif-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.m2d-btn-xs {
    padding: 6px 14px;
    font-size: 0.75rem;
    border-radius: 16px;
}

/* ============================================
   SEARCH
============================================ */
.m2d-search-box {
    position: relative;
}

.m2d-search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--m2d-bg-card);
    border: 1px solid var(--m2d-border);
    border-radius: 24px;
    color: var(--m2d-text);
    font-size: 0.95rem;
}

.m2d-search-input:focus { outline: none; border-color: var(--m2d-primary); }

.m2d-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--m2d-text-muted);
}

.m2d-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius-sm);
    box-shadow: var(--m2d-shadow);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.m2d-search-results.show { display: block; }

.m2d-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.m2d-search-result:hover { background: var(--m2d-bg-input); }
.m2d-search-result img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

/* ============================================
   MY EVENTS
============================================ */
.m2d-events-page {
    padding-bottom: 20px;
}

.m2d-page-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius-sm);
    padding: 4px;
}

.m2d-page-tab {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--m2d-text-muted);
    background: transparent;
    border: none;
    border-radius: var(--m2d-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.m2d-page-tab:hover {
    color: var(--m2d-text);
}

.m2d-page-tab.active {
    background: var(--m2d-primary);
    color: white;
}

.m2d-tab-badge {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.m2d-page-tab:not(.active) .m2d-tab-badge {
    background: var(--m2d-bg-input);
}

.m2d-tab-content {
    display: none;
}

.m2d-tab-content.active {
    display: block;
}

.m2d-my-events { display: flex; flex-direction: column; gap: 12px; }

.m2d-event-item {
    background: var(--m2d-bg-card);
    border-radius: var(--m2d-radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.m2d-event-item:hover { transform: translateX(4px); }

.m2d-event-date {
    width: 50px;
    text-align: center;
    background: var(--m2d-primary);
    border-radius: 8px;
    padding: 8px;
}

.m2d-event-date-day { font-size: 1.25rem; font-weight: 700; }
.m2d-event-date-month { font-size: 0.7rem; text-transform: uppercase; }

.m2d-event-info { flex: 1; }
.m2d-event-title { font-weight: 600; margin-bottom: 4px; }
.m2d-event-meta { font-size: 0.85rem; color: var(--m2d-text-muted); }

.m2d-event-chat-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--m2d-bg-input);
    color: var(--m2d-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   UTILITIES
============================================ */
.m2d-loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--m2d-text-muted); }
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ============================================
   RATING SYSTEM
============================================ */
.m2d-event-actions-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.m2d-event-rate-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--m2d-bg-input);
    color: var(--m2d-warning);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.m2d-event-rate-btn:hover {
    background: var(--m2d-warning);
    color: white;
}

.m2d-rating-participant {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--m2d-border);
}

.m2d-rating-participant:last-child {
    border-bottom: none;
}

.m2d-rating-participant img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.m2d-rating-participant-info {
    flex: 1;
}

.m2d-rating-participant-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.m2d-rating-stars {
    display: flex;
    gap: 4px;
}

.m2d-rating-stars .star {
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--m2d-text-muted);
}

.m2d-rating-stars .star:hover {
    color: var(--m2d-warning);
    transform: scale(1.2);
}

.m2d-rating-given {
    color: var(--m2d-success);
    font-size: 0.85rem;
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 480px) {
    .m2d-chat-panel { max-width: 100%; }
    .m2d-notif-panel { right: 8px; left: 8px; width: auto; }
    .m2d-toasts { right: 10px; left: 10px; }
    .m2d-toast { max-width: 100%; }
    .m2d-friends-grid { grid-template-columns: 1fr; }
}
