/* ═══════════════════════════════════════════════════════════════════
   DiamondMessenger — Core Stylesheet
   Aesthetic: Luxury dark with prismatic diamond accents
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --dm-bg:          #f4f2f7;
    --dm-surface:     #ffffff;
    --dm-surface-2:   #f0eef5;
    --dm-surface-3:   #e8e5f0;
    --dm-border:      #d8d5e3;
    --dm-border-glow: #c5c0d8;
    --dm-text:        #1a1a2e;
    --dm-text-muted:  #6b6b8a;
    --dm-text-faint:  #9898b2;
    --dm-accent:      #7c6cf0;
    --dm-accent-2:    #6c5ce7;
    --dm-diamond:     linear-gradient(135deg, #7c6cf0, #a78bfa, #60d5f7, #f0abfc);
    --dm-danger:      #ef4444;
    --dm-success:     #10b981;
    --dm-warning:     #f59e0b;
    --dm-radius:      12px;
    --dm-radius-lg:   20px;
    --dm-shadow:      0 4px 24px rgba(0,0,0,.08);
    --dm-shadow-glow: 0 0 30px rgba(124,108,240,.1);
    --dm-font:        'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --dm-font-display:'Playfair Display', Georgia, serif;
    --dm-transition:  .25s cubic-bezier(.4,0,.2,1);
    --dm-max-width:   680px;
    --dm-nav-height:  64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--dm-font); background: var(--dm-bg); color: var(--dm-text); line-height: 1.6; min-height: 100vh; }
a { color: var(--dm-accent-2); text-decoration: none; transition: color var(--dm-transition); }
a:hover { color: #c4b5fd; }
img { max-width: 100%; height: auto; display: block; }

/* ─── Utility ───────────────────────────────────────────────────── */
.dm-container { max-width: var(--dm-max-width); margin: 0 auto; padding: 0 20px; }
.dm-wide-container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.dm-page { padding-top: calc(var(--dm-nav-height) + 24px); padding-bottom: 60px; min-height: 100vh; }
.dm-section-title { font-family: var(--dm-font-display); font-size: 1.5rem; font-weight: 600; margin-bottom: 20px; background: var(--dm-diamond); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ─── Navbar ────────────────────────────────────────────────────── */
.dm-nav { position: fixed; top: 0; left: 0; right: 0; height: var(--dm-nav-height); background: rgba(255,255,255,.9); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); border-bottom: 1px solid var(--dm-border); z-index: 1000; display: flex; align-items: center; padding: 0 24px; }
.dm-nav__logo { font-family: var(--dm-font-display); font-size: 1.35rem; font-weight: 700; background: var(--dm-diamond); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -.02em; margin-right: auto; }
.dm-nav__logo:hover { opacity: .85; }
.dm-nav__links { display: flex; align-items: center; gap: 6px; }
.dm-nav__link { position: relative; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; color: var(--dm-text-muted); transition: all var(--dm-transition); }
.dm-nav__link:hover, .dm-nav__link--active { background: var(--dm-surface-2); color: var(--dm-text); }
.dm-nav__link svg { width: 20px; height: 20px; }
.dm-nav__badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--dm-danger); color: #fff; font-size: .65rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; line-height: 1; }
.dm-nav__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--dm-border); margin-left: 4px; transition: border-color var(--dm-transition); }
.dm-nav__avatar:hover { border-color: var(--dm-accent); }
.dm-nav__hamburger { display: none; background: none; border: none; color: var(--dm-text); cursor: pointer; padding: 8px; }

@media (max-width: 640px) {
    .dm-nav__links { display: none; }
    .dm-nav__links.open { display: flex; flex-direction: column; position: absolute; top: var(--dm-nav-height); left: 0; right: 0; background: var(--dm-surface); border-bottom: 1px solid var(--dm-border); padding: 12px; gap: 4px; }
    .dm-nav__links.open .dm-nav__link { width: 100%; height: 44px; justify-content: flex-start; padding: 0 16px; gap: 12px; border-radius: 10px; }
    .dm-nav__hamburger { display: block; }
}

/* ─── Cards ─────────────────────────────────────────────────────── */
.dm-card { background: var(--dm-surface); border: 1px solid var(--dm-border); border-radius: var(--dm-radius-lg); padding: 24px; transition: border-color var(--dm-transition), box-shadow var(--dm-transition); }
.dm-card:hover { border-color: var(--dm-border-glow); }
.dm-card + .dm-card { margin-top: 16px; }

/* ─── Forms ─────────────────────────────────────────────────────── */
.dm-input { width: 100%; padding: 12px 16px; background: var(--dm-surface-2); border: 1px solid var(--dm-border); border-radius: var(--dm-radius); color: var(--dm-text); font-family: var(--dm-font); font-size: .95rem; transition: all var(--dm-transition); outline: none; }
.dm-input:focus { border-color: var(--dm-accent); box-shadow: 0 0 0 3px rgba(124,108,240,.2); }
.dm-input::placeholder { color: var(--dm-text-faint); }
textarea.dm-input { resize: vertical; min-height: 60px; }
.dm-input[type="file"] { padding: 10px; font-size: .85rem; }
.dm-checkbox { accent-color: var(--dm-accent); width: 18px; height: 18px; cursor: pointer; }
.dm-field { margin-bottom: 16px; }
.dm-field label { display: block; font-size: .85rem; font-weight: 500; color: var(--dm-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.dm-helptext { font-size: .8rem; color: var(--dm-text-faint); margin-top: 4px; }

/* ─── Buttons ───────────────────────────────────────────────────── */
.dm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 22px; border-radius: var(--dm-radius); font-family: var(--dm-font); font-size: .9rem; font-weight: 600; border: none; cursor: pointer; transition: all var(--dm-transition); text-decoration: none; line-height: 1.4; }
.dm-btn--primary { background: var(--dm-diamond); color: #fff; box-shadow: 0 2px 16px rgba(124,108,240,.3); }
.dm-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 4px 24px rgba(124,108,240,.45); color: #fff; }
.dm-btn--secondary { background: var(--dm-surface-2); color: var(--dm-text); border: 1px solid var(--dm-border); }
.dm-btn--secondary:hover { background: var(--dm-surface-3); border-color: var(--dm-border-glow); color: var(--dm-text); }
.dm-btn--danger { background: var(--dm-danger); color: #fff; }
.dm-btn--danger:hover { opacity: .9; color: #fff; }
.dm-btn--sm { padding: 6px 14px; font-size: .8rem; }
.dm-btn--block { width: 100%; }
.dm-btn--ghost { background: transparent; color: var(--dm-text-muted); padding: 8px 12px; border: none; cursor: pointer; font-family: var(--dm-font); font-size: .85rem; border-radius: 8px; transition: all var(--dm-transition); }
.dm-btn--ghost:hover { color: var(--dm-text); background: var(--dm-surface-2); }

/* ─── Post Card ─────────────────────────────────────────────────── */
.dm-post { background: var(--dm-surface); border: 1px solid var(--dm-border); border-radius: var(--dm-radius-lg); overflow: hidden; transition: border-color var(--dm-transition); }
.dm-post:hover { border-color: var(--dm-border-glow); }
.dm-post + .dm-post { margin-top: 16px; }
.dm-post__header { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.dm-post__avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--dm-border); flex-shrink: 0; }
.dm-post__author { font-weight: 600; font-size: .95rem; }
.dm-post__time { font-size: .8rem; color: var(--dm-text-muted); }
.dm-post__body { padding: 14px 20px; font-size: .95rem; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.dm-post__media { width: 100%; max-height: 500px; object-fit: cover; }
.dm-post__media-wrap video { width: 100%; max-height: 500px; background: #000; }
.dm-post__link-card { margin: 0 20px 12px; padding: 14px 16px; background: var(--dm-surface-2); border: 1px solid var(--dm-border); border-radius: var(--dm-radius); display: block; transition: background var(--dm-transition); }
.dm-post__link-card:hover { background: var(--dm-surface-3); }
.dm-post__link-url { font-size: .75rem; color: var(--dm-accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-post__link-title { font-weight: 600; color: var(--dm-text); font-size: .95rem; }
.dm-post__actions { display: flex; align-items: center; gap: 4px; padding: 8px 16px 14px; border-top: 1px solid var(--dm-border); margin-top: 4px; }
.dm-post__action-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; background: transparent; border: none; color: var(--dm-text-muted); font-family: var(--dm-font); font-size: .85rem; font-weight: 500; cursor: pointer; transition: all var(--dm-transition); }
.dm-post__action-btn:hover { background: var(--dm-surface-2); color: var(--dm-text); }
.dm-post__action-btn.liked { color: var(--dm-danger); }
.dm-post__action-btn svg { width: 18px; height: 18px; }
.dm-post__share-link { margin-left: auto; }

/* ─── Comments ──────────────────────────────────────────────────── */
.dm-comments { padding: 16px 20px; background: var(--dm-surface-2); border-top: 1px solid var(--dm-border); }
.dm-comment { display: flex; gap: 10px; padding: 10px 0; }
.dm-comment + .dm-comment { border-top: 1px solid rgba(0,0,0,.06); }
.dm-comment__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.dm-comment__author { font-weight: 600; font-size: .85rem; }
.dm-comment__text { font-size: .9rem; line-height: 1.5; color: var(--dm-text); margin-top: 2px; }
.dm-comment__time { font-size: .75rem; color: var(--dm-text-faint); margin-top: 2px; }

/* ─── Profile ───────────────────────────────────────────────────── */
.dm-profile-cover { width: 100%; height: 260px; background: var(--dm-surface-2); background-size: cover; background-position: center; border-radius: var(--dm-radius-lg) var(--dm-radius-lg) 0 0; position: relative; }
.dm-profile-info { background: var(--dm-surface); border: 1px solid var(--dm-border); border-top: none; border-radius: 0 0 var(--dm-radius-lg) var(--dm-radius-lg); padding: 0 24px 24px; position: relative; }
.dm-profile-avatar { width: 110px; height: 110px; border-radius: 50%; border: 4px solid var(--dm-surface); object-fit: cover; position: relative; top: -55px; margin-bottom: -40px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }
.dm-profile-avatar--placeholder { width: 110px; height: 110px; border-radius: 50%; border: 4px solid var(--dm-surface); position: relative; top: -55px; margin-bottom: -40px; background: var(--dm-diamond); display: flex; align-items: center; justify-content: center; font-family: var(--dm-font-display); font-size: 2.2rem; font-weight: 700; color: #fff; }
.dm-profile-name { font-family: var(--dm-font-display); font-size: 1.6rem; font-weight: 700; }
.dm-profile-username { color: var(--dm-text-muted); font-size: .9rem; }
.dm-profile-bio { margin-top: 10px; color: var(--dm-text); line-height: 1.6; }
.dm-profile-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: .85rem; color: var(--dm-text-muted); }
.dm-profile-meta svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.dm-profile-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ─── Friends Grid ──────────────────────────────────────────────── */
.dm-friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.dm-friend-card { background: var(--dm-surface); border: 1px solid var(--dm-border); border-radius: var(--dm-radius); padding: 18px; display: flex; flex-direction: column; align-items: center; text-align: center; transition: border-color var(--dm-transition); }
.dm-friend-card:hover { border-color: var(--dm-border-glow); }
.dm-friend-card__avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; border: 2px solid var(--dm-border); }
.dm-friend-card__name { font-weight: 600; font-size: .95rem; color: var(--dm-text); }
.dm-friend-card__username { font-size: .8rem; color: var(--dm-text-muted); }

/* ─── Inbox / Messages ──────────────────────────────────────────── */
.dm-convo-list { list-style: none; }
.dm-convo-item { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--dm-border); transition: background var(--dm-transition); cursor: pointer; text-decoration: none; color: var(--dm-text); }
.dm-convo-item:hover { background: var(--dm-surface-2); color: var(--dm-text); }
.dm-convo-item__avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--dm-border); flex-shrink: 0; }
.dm-convo-item__name { font-weight: 600; font-size: .95rem; }
.dm-convo-item__preview { font-size: .85rem; color: var(--dm-text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.dm-chat { display: flex; flex-direction: column; height: calc(100vh - var(--dm-nav-height) - 40px); }
.dm-chat__header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--dm-border); background: var(--dm-surface); flex-shrink: 0; }
.dm-chat__messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.dm-msg { max-width: 70%; padding: 12px 16px; border-radius: 16px; font-size: .9rem; line-height: 1.5; position: relative; }
.dm-msg--sent { align-self: flex-end; background: var(--dm-accent); color: #fff; border-bottom-right-radius: 4px; }
.dm-msg--received { align-self: flex-start; background: var(--dm-surface-2); border: 1px solid var(--dm-border); border-bottom-left-radius: 4px; }
.dm-msg__time { font-size: .7rem; opacity: .6; margin-top: 4px; }
.dm-chat__input { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--dm-border); background: var(--dm-surface); flex-shrink: 0; }
.dm-chat__input .dm-input { flex: 1; }

/* ─── Notifications ─────────────────────────────────────────────── */
.dm-notif { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--dm-border); transition: background var(--dm-transition); }
.dm-notif--unread { background: rgba(124,108,240,.06); }
.dm-notif:hover { background: var(--dm-surface-2); }
.dm-notif__avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.dm-notif__text { font-size: .9rem; flex: 1; }
.dm-notif__time { font-size: .75rem; color: var(--dm-text-faint); white-space: nowrap; }

/* ─── Landing ───────────────────────────────────────────────────── */
.dm-landing { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; position: relative; overflow: hidden; }
.dm-landing::before { content: ''; position: absolute; top: -40%; left: -20%; width: 140%; height: 140%; background: radial-gradient(ellipse at 30% 20%, rgba(124,108,240,.15) 0%, transparent 50%), radial-gradient(ellipse at 70% 80%, rgba(96,213,247,.12) 0%, transparent 50%), radial-gradient(ellipse at 50% 50%, rgba(240,171,252,.1) 0%, transparent 60%); pointer-events: none; animation: dm-glow 12s ease-in-out infinite alternate; }
@keyframes dm-glow { 0% { opacity: 1; transform: scale(1); } 100% { opacity: .7; transform: scale(1.05); } }
.dm-landing__diamond { width: 80px; height: 80px; background: var(--dm-diamond); clip-path: polygon(50% 0%, 100% 35%, 80% 100%, 20% 100%, 0% 35%); margin-bottom: 30px; position: relative; animation: dm-float 4s ease-in-out infinite; }
@keyframes dm-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.dm-landing__title { font-family: var(--dm-font-display); font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 700; background: var(--dm-diamond); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.15; margin-bottom: 16px; position: relative; }
.dm-landing__subtitle { font-size: 1.15rem; color: var(--dm-text-muted); max-width: 480px; margin-bottom: 36px; position: relative; }
.dm-landing__actions { display: flex; gap: 14px; position: relative; }

/* ─── Auth Pages ────────────────────────────────────────────────── */
.dm-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.dm-auth-card { background: var(--dm-surface); border: 1px solid var(--dm-border); border-radius: var(--dm-radius-lg); padding: 40px 36px; width: 100%; max-width: 420px; box-shadow: var(--dm-shadow); }
.dm-auth-card__title { font-family: var(--dm-font-display); font-size: 1.6rem; font-weight: 700; text-align: center; margin-bottom: 24px; background: var(--dm-diamond); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.dm-auth-card__footer { text-align: center; margin-top: 20px; font-size: .9rem; color: var(--dm-text-muted); }

/* ─── Alerts ────────────────────────────────────────────────────── */
.dm-messages { position: fixed; top: calc(var(--dm-nav-height) + 12px); right: 20px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.dm-alert { padding: 14px 18px; border-radius: var(--dm-radius); font-size: .9rem; font-weight: 500; animation: dm-slideIn .3s ease; box-shadow: var(--dm-shadow); }
.dm-alert--success { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.dm-alert--error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.dm-alert--info { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
@keyframes dm-slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
.dm-error-list { list-style: none; margin-bottom: 16px; }
.dm-error-list li { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 10px 14px; margin-bottom: 6px; font-size: .85rem; color: #991b1b; }

/* ─── Empty States ──────────────────────────────────────────────── */
.dm-empty { text-align: center; padding: 60px 20px; color: var(--dm-text-muted); }
.dm-empty svg { width: 48px; height: 48px; opacity: .4; margin-bottom: 14px; }
.dm-empty__title { font-size: 1.1rem; font-weight: 600; margin-bottom: 6px; color: var(--dm-text); }
.dm-empty__text { font-size: .9rem; }

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .dm-card { padding: 18px; border-radius: var(--dm-radius); }
    .dm-post__header { padding: 14px 16px 0; }
    .dm-post__body { padding: 10px 16px; }
    .dm-post__actions { padding: 8px 12px 12px; }
    .dm-profile-cover { height: 180px; }
    .dm-profile-avatar, .dm-profile-avatar--placeholder { width: 80px; height: 80px; top: -40px; margin-bottom: -28px; }
    .dm-friend-grid { grid-template-columns: 1fr 1fr; }
    .dm-msg { max-width: 85%; }
    .dm-landing__actions { flex-direction: column; width: 100%; max-width: 280px; }
}
