:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --accent-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-bg: #0a0a0f;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);
    --text-primary: #ffffff;
    --text-secondary: #a0a9c0;
    --shadow-primary: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    --shadow-glow: 0 0 60px rgba(102, 126, 234, 0.15);
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    outline: none !important; 
}

body, html { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--dark-bg);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
}

/* === MODERN ANIMATED BACKGROUND === */
.auth-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(118, 75, 162, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(240, 147, 251, 0.05) 0%, transparent 50%);
    animation: backgroundFlow 20s ease-in-out infinite;
    z-index: -2;
}

@keyframes backgroundFlow {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-2%, -2%) rotate(1deg); }
    66% { transform: translate(2%, -1%) rotate(-1deg); }
}

/* === FLOATING GEOMETRIC SHAPES === */
.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.shape {
    position: absolute;
    background: var(--primary-gradient);
    border-radius: 50%;
    opacity: 0.1;
    animation: float 15s infinite linear;
}

.shape:nth-child(1) { width: 80px; height: 80px; top: 20%; left: 10%; animation-delay: -2s; animation-duration: 18s; }
.shape:nth-child(2) { width: 40px; height: 40px; top: 60%; left: 80%; animation-delay: -8s; animation-duration: 22s; }
.shape:nth-child(3) { width: 120px; height: 120px; top: 80%; left: 20%; animation-delay: -15s; animation-duration: 25s; }
.shape:nth-child(4) { width: 60px; height: 60px; top: 10%; left: 70%; animation-delay: -4s; animation-duration: 20s; }

@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
    100% { transform: translateY(0px) rotate(360deg); }
}

/* === ULTRA MODERN AUTH CARD === */
.auth-card {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 60px 50px;
    width: 480px;
    max-width: 90vw;
    text-align: center;
    box-shadow: var(--shadow-primary), var(--shadow-glow);
    position: relative;
    animation: cardEntrance 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--primary-gradient);
    border-radius: 32px 32px 0 0;
}

/* === BRAND SECTION === */
.brand-section {
    margin-bottom: 50px;
    animation: fadeInUp 1s ease-out 0.3s both;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 20px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.auth-title {
    font-weight: 800;
    font-size: 2.8rem;
    margin-bottom: 12px;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #ffffff 0%, #a0a9c0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    margin-bottom: 40px;
}

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

/* === MODERN FORM ELEMENTS === */
.form-section {
    animation: fadeInUp 1s ease-out 0.6s both;
}

.input-group {
    position: relative;
    margin-bottom: 30px;
}

.form-input-modern {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px;
    padding: 24px 20px;
    color: var(--text-primary) !important;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 8px;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', monospace;
}

.form-input-modern:focus {
    border-color: rgba(102, 126, 234, 0.6) !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateY(-2px);
}

.form-input-modern::placeholder {
    color: var(--text-secondary);
    letter-spacing: 4px;
    font-weight: 300;
}

.error-message {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 12px;
    padding: 16px;
    color: #fca5a5;
    font-size: 0.9rem;
    font-weight: 500;
    margin: -15px 0 25px 0;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.btn-modern {
    background: var(--primary-gradient);
    border: none;
    border-radius: 20px;
    padding: 20px 40px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
    cursor: pointer;
    width: 100%;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s;
}

.btn-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.4);
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-modern:active {
    transform: translateY(-1px);
}

/* === WELCOME SCREEN ENHANCEMENTS === */
.welcome-card {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 70px 60px;
    width: 600px;
    max-width: 90vw;
    text-align: center;
    box-shadow: var(--shadow-primary), var(--shadow-glow);
    position: relative;
    animation: welcomeEntrance 1s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes welcomeEntrance {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--success-gradient);
    border-radius: 32px 32px 0 0;
}

.welcome-avatar {
    width: 80px;
    height: 80px;
    background: var(--success-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 30px auto;
    animation: avatarPulse 2s ease-in-out infinite;
}

@keyframes avatarPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(79, 172, 254, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(79, 172, 254, 0); }
}

.welcome-title {
    font-weight: 800;
    font-size: 3.2rem;
    margin-bottom: 20px;
    letter-spacing: -2px;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 1s ease-out 0.4s both;
}

.welcome-message {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
    line-height: 1.8;
    margin-bottom: 50px;
    animation: fadeInUp 1s ease-out 0.6s both;
}

.project-name {
    color: var(--text-primary);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 12px;
    border-radius: 8px;
    display: inline-block;
}

.footer-text {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 40px;
    letter-spacing: 0.5px;
    animation: fadeInUp 1s ease-out 0.9s both;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .auth-card, .welcome-card {
        padding: 40px 30px;
        border-radius: 24px;
    }
    
    .auth-title, .welcome-title {
        font-size: 2.2rem;
    }
    
    .form-input-modern {
        font-size: 1rem;
        letter-spacing: 4px;
    }
}

/* === VIEWER & SIDEBAR STYLES === */
.viewer-container { 
    display: flex; 
    width: 100vw; 
    height: 100vh; 
    position: relative; 
}

.project-frame { 
    flex: 1; 
    border: none; 
    background: #fff; 
    transition: all 0.6s cubic-bezier(0.85, 0, 0.15, 1); 
    z-index: 1; 
}

.sidebar { 
    width: 400px; 
    height: 100%; 
    background: rgba(15, 23, 42, 0.95); 
    backdrop-filter: blur(30px);
    border-left: 1px solid var(--glass-border); 
    display: flex; 
    flex-direction: column; 
    padding: 50px 35px; 
    position: relative; 
    transition: all 0.6s cubic-bezier(0.85, 0, 0.15, 1); 
    z-index: 100; 
    box-shadow: -20px 0 60px rgba(0,0,0,0.6);
}

.sidebar.collapsed { 
    margin-right: -400px; 
}

.sidebar-toggle {
    position: absolute; 
    left: -55px; 
    top: 40px; 
    width: 55px; 
    height: 55px; 
    background: #6366f1;
    color: white; 
    border: none; 
    border-radius: 18px 0 0 18px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    box-shadow: -5px 5px 20px rgba(0,0,0,0.3); 
    transition: 0.3s; 
    font-size: 1.1rem;
}

.sidebar-toggle:hover { 
    background: #4f46e5; 
    transform: scale(1.05); 
}

.sidebar-toggle i { 
    transition: all 0.6s cubic-bezier(0.85, 0, 0.15, 1); 
}

.sidebar.collapsed .sidebar-toggle i { 
    transform: rotate(180deg); 
}

h2.sb-title { 
    color: white; 
    font-weight: 800; 
    font-size: 1.6rem; 
    margin-bottom: 40px; 
}

.data-card { 
    background: rgba(255, 255, 255, 0.02); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    padding: 22px; 
    border-radius: 22px; 
    margin-bottom: 20px; 
    transition: 0.3s; 
}

.data-card:hover { 
    border-color: rgba(99,102,241,0.3); 
    background: rgba(255,255,255,0.04); 
}

.data-label { 
    font-size: 0.65rem; 
    color: #94a3b8; 
    text-transform: uppercase; 
    margin-bottom: 6px; 
    font-weight: 700; 
    letter-spacing: 1px; 
}

.data-value { 
    font-size: 0.95rem; 
    font-weight: 600; 
    color: white; 
}

.status-badge { 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    padding: 6px 16px; 
    border-radius: 50px; 
    font-size: 0.75rem; 
    font-weight: 800; 
    text-transform: uppercase; 
    animation: pulse 2s infinite; 
}

.st-preview { 
    background: rgba(99,102,241,0.15); 
    color: #a5b4fc; 
    border: 1px solid rgba(99,102,241,0.3); 
}

.st-done { 
    background: rgba(16, 185, 129, 0.15); 
    color: #6ee7b7; 
    border: 1px solid rgba(16, 185, 129, 0.3); 
}

@keyframes pulse { 
    0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); } 
    70% { box-shadow: 0 0 0 10px rgba(99,102,241,0); } 
    100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); } 
}

.btn-sb { 
    background: white; 
    color: black; 
    text-decoration: none; 
    padding: 18px; 
    border-radius: 20px; 
    text-align: center; 
    font-weight: 800; 
    font-size: 0.9rem; 
    transition: 0.3s; 
    display: block; 
    width: 100%; 
    border: none; 
    cursor: pointer; 
}

.btn-sb:hover { 
    background: #6366f1; 
    color: white; 
    transform: translateY(-3px); 
    box-shadow: 0 15px 30px rgba(99,102,241,0.3); 
}

/* === MODAL STYLES === */
.modal-content { 
    background: #0f172a; 
    color: white; 
    border-radius: 35px; 
    border: 1px solid rgba(255,255,255,0.1); 
    padding: 20px; 
}

#sig-pad { 
    border: 2px solid #1e293b; 
    background: white; 
    border-radius: 20px; 
    width: 100%; 
    height: 200px; 
    cursor: crosshair; 
}

.form-control-modal { 
    background: #1e293b !important; 
    border: 1px solid rgba(255,255,255,0.1) !important; 
    color: white !important; 
    border-radius: 15px; 
    padding: 15px; 
}

/* === RESPONSIVE VIEWER === */
@media (max-width: 1200px) {
    .sidebar {
        width: 350px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 300px;
    }
    
    .sidebar-toggle {
        left: -45px;
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .viewer-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        min-height: 300px;
        max-height: 50vh;
        overflow-y: auto;
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }
    
    .sidebar.collapsed {
        margin-right: 0;
        margin-bottom: -100%;
    }
    
    .sidebar-toggle {
        top: -45px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 18px 18px 0 0;
        width: 80px;
        height: 45px;
    }
    
    .sidebar.collapsed .sidebar-toggle i {
        transform: rotate(90deg);
    }
}