:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99,102,241,0.3);
    --accent: #ec4899;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-bg-solid: rgba(30, 41, 59, 0.65);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.15);
    --input-bg: rgba(15, 23, 42, 0.6);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* ===== Dynamic Animated Background ===== */
.background-container {
    position: fixed;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(100px);
    border-radius: 50%;
    animation: float 20s infinite alternate cubic-bezier(0.5, 0, 0.5, 1);
    opacity: 0.4;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: #4f46e5;
    top: -150px;
    left: -100px;
    animation-duration: 28s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: #ec4899;
    bottom: -100px;
    right: -100px;
    animation-duration: 22s;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: #06b6d4;
    top: 50%;
    left: 50%;
    animation-duration: 25s;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(80px, -60px) scale(1.15); }
    66% { transform: translate(-40px, 80px) scale(0.95); }
    100% { transform: translate(60px, 40px) scale(1.05); }
}

/* ===== Auth View — Glassmorphism Card (Centered) ===== */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.4s ease;
}

.hidden-view {
    display: none !important;
}

.brand {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    height: 60px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto 15px;
    display: block;
    background: #ffffff;
    padding: 8px 16px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo:hover {
    transform: scale(1.03);
    box-shadow: 0 0 22px rgba(255, 255, 255, 0.95), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.brand h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.brand p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Forms */
form {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

form.active-form {
    display: block;
}

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

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    font-family: inherit;
}

.primary-btn {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.danger-btn {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.danger-btn:hover {
    background: var(--danger-hover);
    transform: translateY(-2px);
}

.outline-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.outline-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.toggle-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 20px;
}

.link {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s;
}

.link:hover {
    color: #818cf8;
    text-decoration: underline;
}

/* Messages */
.message {
    font-size: 0.85rem;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    display: none;
    text-align: center;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.success-message {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.dashboard-actions {
    margin-top: 30px;
}

/* Module Navigation Cards (old dashboard) */
.modules-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.module-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s ease;
    cursor: pointer;
}

.module-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.module-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.module-info {
    flex: 1;
    min-width: 0;
}

.module-info h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.module-info p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.module-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.3s, color 0.3s;
}

.module-card:hover .module-arrow {
    transform: translateX(4px);
    color: var(--primary);
}


/* ================================================================
   DASHBOARD LAYOUT — Post-Login Full-Screen View
   ================================================================ */

/* When dashboard is active, body switches to full layout */
body.dashboard-active {
    display: block;
    overflow: hidden;
}

/* Top Navigation Bar */
.dash-top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 30px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
}

.dash-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-nav-logo-img {
    height: 38px;
    width: auto;
    object-fit: contain;
    display: block;
    background: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.75), 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dash-nav-logo-img:hover {
    transform: scale(1.03);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.9), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dash-nav-left h2 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.dash-nav-accent {
    color: var(--accent);
    font-weight: 400;
}

.dash-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dash-nav-user {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.dash-home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    cursor: pointer;
    transition: all 0.25s;
}

.dash-home-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.dash-logout-nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
}

.dash-logout-nav-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Main Dashboard Layout (Sidebar + Content) */
.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: calc(100vh - 65px);
    position: relative;
    z-index: 1;
}

/* ===== Dashboard Sidebar ===== */
.dashboard-sidebar {
    background: var(--card-bg-solid);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.dashboard-sidebar::-webkit-scrollbar { width: 4px; }
.dashboard-sidebar::-webkit-scrollbar-track { background: transparent; }
.dashboard-sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    padding: 16px 14px 8px;
}

.sidebar-section-label:first-child {
    padding-top: 8px;
}

.sidebar-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    text-align: left;
}

.sidebar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-main);
}

.sidebar-nav-btn:hover .sidebar-nav-icon {
    transform: scale(1.08);
}

.sidebar-nav-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.25s;
}

.sidebar-nav-label {
    flex: 1;
    min-width: 0;
}

.sidebar-nav-label span {
    display: block;
}

.sidebar-nav-label .nav-label-title {
    font-weight: 600;
    font-size: 0.88rem;
}

.sidebar-nav-label .nav-label-desc {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 1px;
}

.sidebar-nav-arrow {
    color: var(--text-dim);
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.25s;
}

.sidebar-nav-btn:hover .sidebar-nav-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Disabled sidebar items */
.sidebar-nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-nav-btn.disabled:hover {
    background: transparent;
    border-color: transparent;
}

.coming-soon-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dim);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* Sidebar spacer */
.sidebar-spacer {
    flex: 1;
}

/* Sidebar bottom actions */
.sidebar-bottom {
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-danger-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s;
}

.sidebar-danger-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
}

/* ===== Dashboard Main Area ===== */
.dashboard-main {
    padding: 28px 32px;
    overflow-y: auto;
    overflow-x: hidden;
}

.dashboard-main::-webkit-scrollbar { width: 6px; }
.dashboard-main::-webkit-scrollbar-track { background: transparent; }
.dashboard-main::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }

.dashboard-welcome {
    margin-bottom: 32px;
}

.dashboard-welcome h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.dashboard-welcome p {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* ===== Pinned Sections ===== */
.pinned-section {
    margin-bottom: 32px;
    animation: fadeIn 0.4s ease forwards;
}

.pinned-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.pinned-section-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pinned-section-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    flex: 1;
}

.pinned-section-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 10px;
    border-radius: 12px;
}

.pinned-section-link {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pinned-section-link:hover {
    color: #818cf8;
}

/* Pinned Cards Grid */
.pinned-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

/* ===== Individual Pinned Card ===== */
.pinned-card {
    background: var(--card-bg-solid);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.pinned-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    opacity: 0.7;
}

.pinned-card.pinned-cotizacion::before { background: #818cf8; }
.pinned-card.pinned-proyecto::before { background: #f472b6; }
.pinned-card.pinned-nota::before { background: #fbbf24; }

.pinned-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.pinned-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.pinned-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pinned-card-unpin {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    flex-shrink: 0;
    opacity: 0;
}

.pinned-card:hover .pinned-card-unpin {
    opacity: 1;
}

.pinned-card-unpin:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.pinned-card-body {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.pinned-card-body .meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.pinned-card-body .meta-row:last-child {
    margin-bottom: 0;
}

.pinned-card-body .meta-label {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 50px;
}

.pinned-card-body .meta-value {
    color: var(--text-main);
    font-weight: 500;
}

.pinned-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Status badges for pinned cotizaciones */
.pinned-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.pinned-badge-borrador { background: rgba(250,204,21,0.12); color: #fbbf24; }
.pinned-badge-enviada { background: rgba(59,130,246,0.12); color: #60a5fa; }
.pinned-badge-aceptada { background: rgba(16,185,129,0.12); color: #34d399; }
.pinned-badge-rechazada { background: rgba(239,68,68,0.12); color: #f87171; }

/* Progress bar for pinned projects */
.pinned-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.pinned-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.pinned-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.pinned-progress-label {
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 32px;
    text-align: right;
}

/* Note preview */
.pinned-note-preview {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 4px;
}

.pinned-note-date {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 8px;
}

/* ===== Empty Dashboard ===== */
.dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 40px;
    color: var(--text-dim);
    animation: fadeIn 0.5s ease forwards;
}

.dashboard-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.dashboard-empty h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dashboard-empty p {
    font-size: 0.88rem;
    color: var(--text-dim);
    max-width: 380px;
    line-height: 1.5;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .dashboard-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow-y: visible;
        overflow-x: auto;
    }

    .sidebar-section-label {
        display: none;
    }

    .sidebar-nav-btn {
        flex: 0 0 auto;
        padding: 10px 14px;
        gap: 8px;
    }

    .sidebar-nav-icon {
        width: 32px;
        height: 32px;
    }

    .sidebar-nav-label .nav-label-desc {
        display: none;
    }

    .sidebar-nav-arrow,
    .coming-soon-badge {
        display: none;
    }

    .sidebar-spacer,
    .sidebar-bottom {
        display: none;
    }

    .dashboard-main {
        padding: 20px 16px;
        height: auto;
        overflow-y: visible;
    }

    body.dashboard-active {
        overflow: auto;
    }

    .dash-top-nav {
        padding: 12px 16px;
    }

    .dash-nav-user {
        display: none;
    }

    .pinned-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dashboard-welcome h1 {
        font-size: 1.35rem;
    }
}
