/* ============================================================
   My Workspace — application styles
   Type: Space Grotesk (display) · Inter (UI) · JetBrains Mono (data)
   ============================================================ */

:root {
    --bg:          #F4F5F8;
    --surface:     #FFFFFF;
    --surface-2:   #FAFBFC;
    --ink:         #0E1525;
    --text:        #38404F;
    --muted:       #717B8C;
    --faint:       #9AA3B2;
    --line:        #E7E9EF;
    --line-strong: #D7DBE3;

    --sidebar:     #11141C;
    --sidebar-2:   #1A1F2A;
    --sidebar-line:#262C39;
    --sidebar-txt: #C7CDD9;
    --sidebar-mut: #7C8595;

    --brand:       #4F46E5;
    --brand-600:   #4338CA;
    --brand-700:   #3730A3;
    --brand-soft:  #EEEDFE;
    --brand-ring:  rgba(79,70,229,.28);

    --success:     #0E9F6E;
    --success-soft:#E3F6EE;
    --danger:      #E5484D;
    --danger-600:  #C93B40;
    --danger-soft: #FCEBEB;

    --radius:    16px;
    --radius-md: 12px;
    --radius-sm: 9px;

    --shadow-sm: 0 1px 2px rgba(16,21,37,.05), 0 1px 3px rgba(16,21,37,.04);
    --shadow-md: 0 6px 20px rgba(16,21,37,.08);
    --shadow-lg: 0 18px 48px rgba(16,21,37,.16);

    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* File-type accent colors (consumed by .ftype / .badge via var(--c)) */
.ft-pdf  { --c: #E5484D; }
.ft-doc  { --c: #2F6FED; }
.ft-xls  { --c: #15A05A; }
.ft-ppt  { --c: #E2620E; }
.ft-vid  { --c: #8B5CF6; }
.ft-aud  { --c: #DB2777; }
.ft-img  { --c: #0E9488; }
.ft-zip  { --c: #C2850C; }
.ft-txt  { --c: #5B6675; }
.ft-file { --c: #5B6675; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, .display {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin: 0;
}

a { color: inherit; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 1.9; }

/* ---------- App shell -------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 256px;
    flex: 0 0 256px;
    background: var(--sidebar);
    color: var(--sidebar-txt);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--sidebar-line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 8px 22px;
}
.brand-mark {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: linear-gradient(150deg, #6366F1, #4338CA);
    display: grid; place-items: center;
    color: #fff;
    box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
.brand-mark .icon { width: 21px; height: 21px; stroke-width: 2; }
.brand-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
}
.brand-sub { font-size: 11px; color: var(--sidebar-mut); margin-top: 3px; letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--sidebar-mut);
    padding: 0 10px 8px;
    margin-top: 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--sidebar-txt);
    text-decoration: none;
    font-weight: 500;
    font-size: 14.5px;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.4); }
.nav-item.active .icon { stroke: #fff; }

.side-foot { margin-top: auto; padding-top: 18px; }
.user-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border-radius: 12px;
    background: var(--sidebar-2);
    border: 1px solid var(--sidebar-line);
}
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(150deg, #6366F1, #4338CA);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 15px;
    flex: 0 0 auto;
}
.user-meta { min-width: 0; flex: 1; }
.user-name { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-mut); font-size: 12px; }
.logout-link {
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    color: var(--sidebar-mut);
    text-decoration: none;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.logout-link:hover { background: rgba(229,72,77,.16); color: #FF8589; }

/* ---------- Main column ------------------------------------ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 34px;
    border-bottom: 1px solid var(--line);
    background: rgba(244,245,248,.85);
    backdrop-filter: saturate(140%) blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-titles { min-width: 0; }
.topbar h1 { font-size: 22px; font-weight: 600; }
.topbar .crumb { font-size: 13px; color: var(--muted); margin-top: 2px; }
.topbar-spacer { flex: 1; }

.search {
    position: relative;
    width: min(340px, 42vw);
}
.search .icon {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--faint); width: 17px; height: 17px;
}
.search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface);
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }

.content { padding: 28px 34px 56px; max-width: 1180px; width: 100%; }

/* ---------- Buttons ---------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .16s var(--ease), border-color .16s var(--ease), transform .08s var(--ease), color .16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.28); }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.05); }

/* Icon-only square action buttons */
.iconbtn {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: all .16s var(--ease);
}
.iconbtn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.iconbtn.danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.iconbtn.copied { color: var(--success); border-color: var(--success); background: var(--success-soft); }

/* ---------- Dropzone (upload) ------------------------------ */
.dropzone {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: border-color .18s var(--ease), background .18s var(--ease);
    margin-bottom: 28px;
}
.dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.dz-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid; place-items: center;
    flex: 0 0 auto;
}
.dz-icon .icon { width: 26px; height: 26px; stroke-width: 1.8; }
.dz-text { flex: 1; min-width: 0; }
.dz-text strong { color: var(--ink); font-weight: 600; display: block; font-size: 15px; }
.dz-text span { color: var(--muted); font-size: 13.5px; }
.dz-actions { display: flex; align-items: center; gap: 10px; }
.dz-file { font-size: 13px; color: var(--brand); font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Section heading -------------------------------- */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 4px 0 18px;
}
.section-head h2 { font-size: 16px; font-weight: 600; }
.count-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 2px 9px;
    border-radius: 20px;
}

/* ---------- File grid -------------------------------------- */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(208px, 1fr));
    gap: 18px;
}
.file-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.file-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); transform: translateY(-3px); }

.file-preview {
    height: 132px;
    display: grid;
    place-items: center;
    position: relative;
    background:
        radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--c) 12%, #fff), #fff 70%);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}
.file-preview img { width: 100%; height: 100%; object-fit: cover; }
.ftype {
    width: 60px; height: 72px;
    border-radius: 10px 10px 10px 10px;
    background: #fff;
    border: 1.5px solid color-mix(in srgb, var(--c) 45%, #fff);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--c) 22%, transparent);
    position: relative;
    display: grid; place-items: end center;
    padding-bottom: 9px;
}
.ftype::before {
    content: "";
    position: absolute; top: 0; right: 0;
    border-width: 0 16px 16px 0;
    border-style: solid;
    border-color: color-mix(in srgb, var(--c) 18%, #fff) #fff;
    border-top-right-radius: 9px;
}
.ftype .lbl {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 11px;
    color: var(--c);
    letter-spacing: .02em;
}
.play-badge {
    position: absolute;
    inset: 0;
    display: grid; place-items: center;
    background: rgba(14,21,37,.34);
    color: #fff;
    opacity: 0;
    transition: opacity .18s var(--ease);
}
.file-card:hover .play-badge { opacity: 1; }
.play-badge .icon { width: 38px; height: 38px; stroke-width: 1.6; }

.file-body { padding: 13px 14px 6px; flex: 1; }
.file-name {
    font-weight: 600;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.35;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.file-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--faint);
    margin-top: 6px;
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
}
.file-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }
.file-actions {
    display: flex;
    gap: 8px;
    padding: 10px 14px 14px;
}
.file-actions form { margin: 0; display: inline-flex; }

/* ---------- Clipboard -------------------------------------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 26px;
}
.panel-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 10px; }
.input, .textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--surface-2);
    font-family: inherit;
    font-size: 14.5px;
    color: var(--ink);
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus {
    outline: none; background: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
}
.textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    line-height: 1.6;
}

.clip-list { display: flex; flex-direction: column; gap: 14px; }
.clip-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.clip-card:hover { box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.clip-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.clip-title { font-weight: 600; color: var(--ink); font-size: 15px; word-break: break-word; flex: 1; min-width: 0; }
.clip-date { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.clip-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 12px 14px;
    margin: 0 0 12px;
    max-height: 280px;
    overflow: auto;
}
.clip-actions { display: flex; gap: 8px; }
.clip-actions form { margin: 0; display: inline-flex; }

/* ---------- Empty / no-results ----------------------------- */
.empty {
    text-align: center;
    padding: 56px 24px;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--muted);
}
.empty .icon-wrap {
    width: 58px; height: 58px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: var(--brand-soft);
    color: var(--brand);
    display: grid; place-items: center;
}
.empty .icon-wrap .icon { width: 28px; height: 28px; }
.empty h3 { font-size: 16px; margin-bottom: 6px; color: var(--ink); }
.empty p { margin: 0; font-size: 14px; }
.no-results { display: none; }

/* ---------- Flash toast ------------------------------------ */
.toast {
    position: fixed;
    top: 18px; right: 18px;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    max-width: 360px;
    animation: toast-in .35s var(--ease), toast-out .4s var(--ease) 4s forwards;
}
.toast .icon { width: 20px; height: 20px; }
.toast.ok    { border-left: 4px solid var(--success); }
.toast.ok .icon { color: var(--success); }
.toast.err   { border-left: 4px solid var(--danger); }
.toast.err .icon { color: var(--danger); }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); visibility: hidden; } }

/* ---------- Login ------------------------------------------ */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}
.auth-aside {
    background: var(--sidebar);
    color: #fff;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-aside::after {
    content: "";
    position: absolute;
    width: 420px; height: 420px;
    right: -140px; bottom: -160px;
    background: radial-gradient(circle, rgba(99,102,241,.55), transparent 62%);
    filter: blur(10px);
}
.auth-aside .brand { padding: 0; }
.auth-tagline { position: relative; z-index: 1; }
.auth-tagline h2 {
    color: #fff;
    font-size: 34px;
    line-height: 1.18;
    font-weight: 600;
    letter-spacing: -0.02em;
    max-width: 16ch;
}
.auth-tagline p { color: var(--sidebar-txt); font-size: 15px; margin-top: 16px; max-width: 38ch; }
.auth-points { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }
.auth-point { display: flex; align-items: center; gap: 12px; color: var(--sidebar-txt); font-size: 14.5px; }
.auth-point .tick {
    width: 26px; height: 26px; border-radius: 8px;
    background: rgba(99,102,241,.2); color: #A5B4FC;
    display: grid; place-items: center; flex: 0 0 auto;
}
.auth-point .tick .icon { width: 15px; height: 15px; }

.auth-main { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; font-weight: 600; }
.auth-card .lede { color: var(--muted); margin: 8px 0 28px; font-size: 14.5px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form label { font-size: 13px; font-weight: 600; color: var(--text); display: block; margin-bottom: 7px; }
.auth-form .btn-primary { width: 100%; padding: 13px; font-size: 15px; margin-top: 4px; }
.auth-error {
    display: flex; align-items: center; gap: 9px;
    background: var(--danger-soft);
    color: var(--danger-600);
    border: 1px solid color-mix(in srgb, var(--danger) 26%, #fff);
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 20px;
}
.auth-error .icon { width: 18px; height: 18px; }
.auth-hint {
    margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
    font-size: 12.5px; color: var(--faint); text-align: center;
}

/* ---------- Accessibility & motion ------------------------- */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Responsive ------------------------------------- */
@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar {
        width: auto; flex: none; height: auto;
        position: sticky; top: 0; z-index: 40;
        flex-direction: row; align-items: center;
        padding: 12px 16px; gap: 14px;
    }
    .brand { padding: 0; flex: 0 0 auto; }
    .brand-sub { display: none; }
    .nav-label { display: none; }
    .nav { flex-direction: row; gap: 6px; flex: 1; }
    .nav-item { padding: 9px 13px; }
    .side-foot { margin: 0; padding: 0; }
    .user-card { background: transparent; border: none; padding: 0; gap: 8px; }
    .user-meta { display: none; }
    .topbar { padding: 16px 18px; flex-wrap: wrap; }
    .content { padding: 20px 18px 48px; }
    .search { width: 100%; order: 3; }
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

@media (max-width: 420px) {
    .brand-name { display: none; }
    .dropzone { flex-direction: column; text-align: center; }
    .dz-actions { width: 100%; justify-content: center; }
}
