/*
 * UnikaFTP — Stile Portale Web
 * Design System: "The Neon Curator" — Netlab Srl
 * Primary: Royal Purple #7e4391 | Secondary: Lime Green #caf155
 * Font: Manrope | No-Line Rule | Glassmorphism
 */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

/* === CSS VARIABLES (Neon Curator Design Tokens) === */
:root {
    /* Primary — Royal Purple */
    --primary: #7e4391;
    --primary-dark: #6a3679;
    --primary-light: #9b5eb0;
    --primary-container: #eca8fe;
    --on-primary: #ffffff;

    /* Secondary — Lime Green (high-alert, conversion) */
    --secondary-accent: #caf155;
    --secondary-deep: #4d6300;
    --on-secondary: #1a2000;

    /* Surfaces — Layered paper metaphor */
    --surface: #f1f7ff;
    --surface-container-lowest: #ffffff;
    --surface-container-low: #e6f2ff;
    --surface-container: #dce9f7;
    --surface-container-high: #d0e0f0;
    --surface-container-highest: #cddff0;

    /* Text */
    --on-surface: #25303a;
    --on-surface-muted: #5a6879;
    --outline-variant: #a3aebb;

    /* Functional */
    --destructive: #dc2626;
    --info: #3b82f6;
    --warning: #f59e0b;
    --success: #22c55e;

    /* Radii — Playful & approachable */
    --radius-sm: 0.75rem;
    --radius-md: 1.5rem;
    --radius-lg: 3rem;
    --radius-full: 9999px;

    /* Shadows — Ambient, organic */
    --shadow-sm: 0 4px 12px rgba(37, 48, 58, 0.04);
    --shadow-md: 0 8px 24px rgba(37, 48, 58, 0.06);
    --shadow-lg: 0 20px 40px rgba(37, 48, 58, 0.08);
    --shadow-glow: 0 8px 32px rgba(126, 67, 145, 0.2);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #7e4391, #eca8fe);
    --gradient-dark: linear-gradient(135deg, #1a1025 0%, #25303a 100%);
    --gradient-surface: linear-gradient(180deg, #f1f7ff 0%, #e6f2ff 100%);
}

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

html { font-size: 16px; }

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--surface);
    color: var(--on-surface);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-dark); }

/* === LOGIN PAGE === */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-dark);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

/* Decorative glow orbs */
.login-wrapper::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(126,67,145,0.3), transparent 70%);
    top: -100px;
    right: -100px;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(202,241,85,0.15), transparent 70%);
    bottom: -80px;
    left: -80px;
}

.login-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-lg);
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo h1 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.login-logo p {
    color: var(--on-surface-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.login-error {
    background: #fef2f2;
    color: var(--destructive);
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* === FORM ELEMENTS === */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--on-surface);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--on-surface);
    background: var(--surface-container-highest);
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    background: var(--surface-container-lowest);
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-sm);
}

.form-input::placeholder {
    color: var(--outline-variant);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--on-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    color: var(--on-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* High-visibility CTA — Lime on Purple signature */
.btn-cta {
    background: var(--secondary-accent);
    color: var(--on-secondary);
    box-shadow: var(--shadow-sm);
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(202, 241, 85, 0.3);
    color: var(--on-secondary);
}

.btn-secondary {
    background: var(--surface-container-high);
    color: var(--on-surface);
}

.btn-secondary:hover {
    background: var(--surface-container-highest);
}

.btn-ghost {
    background: transparent;
    color: var(--on-surface);
    padding: 0.5rem 0.875rem;
}

.btn-ghost:hover {
    background: var(--surface-container);
}

.btn-destructive {
    background: var(--destructive);
    color: #ffffff;
}

.btn-destructive:hover {
    background: #b91c1c;
    color: #ffffff;
}

.btn-sm {
    padding: 0.5rem 1.125rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-full);
}

.btn-block { width: 100%; }

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 50%;
}

/* === LAYOUT === */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 272px;
    background: var(--surface-container-lowest);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 10;
}

.sidebar-brand {
    padding: 1.5rem 1.75rem;
    background: var(--surface-container-low);
}

.sidebar-brand h1 {
    font-size: 1.375rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.sidebar-brand span {
    font-size: 0.75rem;
    color: var(--on-surface-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.875rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--on-surface);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.15s;
    margin-bottom: 0.25rem;
}

.sidebar-link:hover {
    background: var(--surface-container);
    color: var(--on-surface);
}

.sidebar-link.active {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: var(--shadow-sm);
}

.sidebar-link .icon {
    width: 1.25rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1.25rem 1.75rem;
    background: var(--surface-container-low);
    font-size: 0.8125rem;
    color: var(--on-surface-muted);
}

.sidebar-footer .user-name {
    font-weight: 700;
    color: var(--on-surface);
}

.main-content {
    margin-left: 272px;
    flex: 1;
    min-height: 100vh;
    background: var(--gradient-surface);
}

.page-header {
    background: var(--surface-container-lowest);
    padding: 1.5rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-body {
    padding: 2rem 2.5rem;
}

/* === CARDS — No-Line Rule: background shifts, no borders === */
.card {
    background: var(--surface-container-lowest);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 1.75rem;
    background: var(--surface-container-low);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.0625rem;
    font-weight: 700;
}

.card-body {
    padding: 1.75rem;
}

/* === PROJECT GRID === */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--surface-container-lowest);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.25s;
}

.project-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.project-card:hover::after {
    opacity: 1;
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.875rem;
}

.project-card-header h3 {
    font-size: 1.1875rem;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: -0.01em;
}

.project-version {
    background: var(--gradient-primary);
    color: var(--on-primary);
    padding: 0.1875rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.project-meta {
    color: var(--on-surface-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.project-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 1rem;
}

/* === FILE BROWSER === */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--on-surface-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    transition: all 0.15s;
}

.breadcrumb a:hover {
    color: var(--primary);
    background: var(--surface-container);
}

.breadcrumb .separator {
    color: var(--outline-variant);
    opacity: 0.5;
}

.breadcrumb .current {
    color: var(--primary);
    font-weight: 700;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
}

.file-table th {
    text-align: left;
    padding: 0.875rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--on-surface-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--surface-container-low);
}

.file-table td {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
}

/* No-Line Rule: alternate tints instead of borders */
.file-table tr:nth-child(even) {
    background: var(--surface);
}

.file-table tr:hover {
    background: var(--surface-container-low);
}

.file-table .file-icon {
    width: 2rem;
    text-align: center;
    font-size: 1.25rem;
}

.file-table .file-name {
    font-weight: 600;
}

.file-table .file-name a {
    color: var(--on-surface);
}

.file-table .file-name a:hover {
    color: var(--primary);
}

.file-table .file-size,
.file-table .file-date {
    color: var(--on-surface-muted);
    font-size: 0.8125rem;
}

.file-table .file-actions {
    text-align: right;
    white-space: nowrap;
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-green { background: rgba(202, 241, 85, 0.25); color: var(--secondary-deep); }
.badge-blue { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.badge-orange { background: rgba(245, 158, 11, 0.12); color: #c2410c; }
.badge-purple { background: rgba(126, 67, 145, 0.12); color: var(--primary); }
.badge-red { background: rgba(220, 38, 38, 0.1); color: var(--destructive); }

/* === TABS (project page) === */
.tab-bar {
    background: var(--surface-container-lowest);
    padding: 0 2.5rem;
}

.tab-bar a,
.btn-ghost[style*="border-bottom"] {
    font-weight: 600 !important;
}

/* === MODAL — Glassmorphism === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 16, 37, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.01em;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* === ACTIVITY LOG === */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 0.875rem 0;
}

/* No-Line Rule: spacing instead of borders */
.activity-item + .activity-item {
    padding-top: 0.875rem;
    background: linear-gradient(to right, var(--surface-container-low) 0%, transparent 100%);
    background-size: 100% 1px;
    background-position: top;
    background-repeat: no-repeat;
}

.activity-time {
    flex-shrink: 0;
    color: var(--on-surface-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    width: 5rem;
    text-align: right;
}

.activity-content {
    font-size: 0.875rem;
}

.activity-role {
    display: inline-block;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    text-align: center;
    line-height: 1.375rem;
    font-size: 0.625rem;
    font-weight: 800;
    color: #fff;
    margin-right: 0.5rem;
}

.activity-role.user { background: var(--primary); }
.activity-role.assistant { background: var(--secondary-accent); color: var(--on-secondary); }

/* === DRAG & DROP ZONE === */
.drop-zone {
    border: 2px dashed var(--outline-variant);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    color: var(--on-surface-muted);
    transition: all 0.25s;
    cursor: pointer;
    font-weight: 500;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(126, 67, 145, 0.06);
    color: var(--primary);
}

/* === SHARE LINK === */
.share-link-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-container-highest);
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
}

.share-link-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--on-surface);
    font-family: 'Manrope', monospace;
    font-weight: 500;
}

.share-link-box input:focus { outline: none; }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--on-surface-muted);
}

.empty-state .icon { font-size: 3.5rem; margin-bottom: 1.25rem; }
.empty-state h3 { color: var(--on-surface); margin-bottom: 0.5rem; font-weight: 700; }
.empty-state p { font-weight: 500; }

/* === TOAST NOTIFICATION === */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-full);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: toastIn 0.3s ease-out;
}

.toast-success { background: var(--primary); }
.toast-error { background: var(--destructive); }

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

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .page-header { padding: 1.25rem; }
    .page-body { padding: 1.25rem; }
    .project-grid { grid-template-columns: 1fr; }
    .login-card { padding: 2rem; border-radius: var(--radius-md); }
}

/* === UTILITIES === */
.text-muted { color: var(--on-surface-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.8125rem; }
.text-primary { color: var(--primary); }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
