/**
 * BarCodeREC — Home Page Styles
 * Role Selection Interface
 */

:root {
    /* Colors */
    --primary-500: #6366F1;
    --primary-600: #4F46E5;
    --primary-700: #4338CA;
    --secondary-500: #EC4899;
    --success-400: #34D399;
    --success-500: #10B981;
    --warning-400: #FBBF24;
    --warning-500: #F59E0B;
    --error-400: #FB7185;
    --error-500: #EF4444;
    --error-600: #DC2626;
    --info-500: #0EA5E9;

    /* Dark Theme */
    --bg-body: #020617;
    --bg-surface: #0F172A;
    --bg-elevated: #1E293B;
    --bg-hover: #334155;
    --bg-active: #475569;

    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-tertiary: #94A3B8;
    --text-muted: #64748B;

    --border: rgba(148, 163, 184, 0.12);
    --border-light: rgba(148, 163, 184, 0.08);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-warning: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    --gradient-error: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --gradient-admin: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --gradient-supervisor: linear-gradient(135deg, #EC4899 0%, #F43F5E 100%);
    --gradient-accountant: linear-gradient(135deg, #10B981 0%, #34D399 100%);
    --gradient-packager: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
    --gradient-scanner: linear-gradient(135deg, #0EA5E9 0%, #06B6D4 100%);
    --gradient-hr: linear-gradient(135deg, #F97316 0%, #FB923C 100%);
    --gradient-investigator: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ═══════════════════════════════════════════════════════
   BACKGROUND EFFECTS
   ═══════════════════════════════════════════════════════ */

.bg-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.bg-gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.bg-gradient-orb-1 {
    width: 400px;
    height: 400px;
    background: var(--gradient-primary);
    top: -100px;
    left: -100px;
}

.bg-gradient-orb-2 {
    width: 300px;
    height: 300px;
    background: var(--gradient-secondary);
    bottom: -50px;
    right: -50px;
    animation-delay: -7s;
}

.bg-gradient-orb-3 {
    width: 250px;
    height: 250px;
    background: var(--gradient-success);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

.bg-grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--border-light) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.03;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ═══════════════════════════════════════════════════════
   AUTH OVERLAY
   ═══════════════════════════════════════════════════════ */

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-overlay.hidden {
    display: none;
}

.auth-modal {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-xl);
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-modal-header i {
    font-size: 2.5rem;
    color: var(--primary-500);
    margin-bottom: 12px;
}

.auth-modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-step {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-step-hidden {
    display: none !important;
}

.auth-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-primary);
}

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

.auth-btn {
    margin-top: 8px;
    padding: 12px 20px;
    width: 100%;
    justify-content: center;
}

.auth-wait-text {
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-align: center;
}

.auth-status {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    text-align: center;
}

.auth-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-500);
    border-radius: var(--radius-md);
    color: var(--error-400);
    font-size: 0.875rem;
    text-align: center;
    display: none;
}

.auth-error.visible {
    display: block;
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

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

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

/* ═══════════════════════════════════════════════════════
   HOME MAIN
   ═══════════════════════════════════════════════════════ */

.home-main {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ═══════════════════════════════════════════════════════
   MOTTO
   ═══════════════════════════════════════════════════════ */

.motto-container {
    position: relative;
    text-align: center;
    margin-bottom: 3rem;
}

.motto-title {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-500) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 80px rgba(99, 102, 241, 0.3);
    animation: mottoPulse 3s ease-in-out infinite;
    letter-spacing: -0.02em;
}

.motto-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes mottoPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.95; }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

/* ═══════════════════════════════════════════════════════
   ROLES CONTAINER
   ═══════════════════════════════════════════════════════ */

.roles-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════
   ROLE TILE
   ═══════════════════════════════════════════════════════ */

.role-tile {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 160px;
    height: 160px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    cursor: pointer;
    transition: all var(--transition-slow);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.role-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-2xl);
    background: var(--tile-gradient, var(--gradient-primary));
    opacity: 0;
    transition: opacity var(--transition-slow);
    z-index: 0;
}

.role-tile:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: var(--shadow-glow);
    border-color: transparent;
}

.role-tile:hover::before {
    opacity: 0.1;
}

.role-tile-icon {
    position: relative;
    z-index: 1;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    background: var(--tile-gradient, var(--gradient-primary));
    color: white;
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all var(--transition-base);
}

.role-tile:hover .role-tile-icon {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.role-tile-label {
    position: relative;
    z-index: 1;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-secondary);
    transition: color var(--transition-base);
    line-height: 1.3;
}

.role-tile:hover .role-tile-label {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════
   SVG LINES
   ═══════════════════════════════════════════════════════ */

.lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.role-line {
    stroke: url(#lineGradient);
    stroke-width: 2;
    fill: none;
    filter: url(#glow);
    opacity: 0.6;
    animation: lineFlow 2s ease-in-out infinite;
}

@keyframes lineFlow {
    0%, 100% { opacity: 0.4; stroke-dashoffset: 0; }
    50% { opacity: 0.8; stroke-dashoffset: 10; }
}

/* ═══════════════════════════════════════════════════════
   USER BAR
   ═══════════════════════════════════════════════════════ */

.user-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: 0.75rem 1.5rem;
    box-shadow: var(--shadow-xl);
    z-index: 100;
}

.user-bar.hidden {
    display: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.user-info i {
    font-size: 1.25rem;
    color: var(--primary-500);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .motto-title {
        font-size: 2.5rem;
    }
    
    .roles-container {
        height: 400px;
    }
    
    .role-tile {
        width: 140px;
        height: 140px;
    }
    
    .role-tile-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    
    .role-tile-label {
        font-size: 0.8125rem;
    }
}

@media (max-width: 768px) {
    .home-main {
        padding: 1rem;
    }
    
    .motto-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }
    
    .roles-container {
        height: auto;
        min-height: 400px;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .role-tile {
        position: relative;
        width: 120px;
        height: 120px;
    }
    
    .lines-svg {
        display: none;
    }
    
    .user-bar {
        bottom: 1rem;
        padding: 0.5rem 1rem;
        gap: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════ */

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

.role-tile {
    animation: tileAppear 0.5s ease-out forwards;
}

/* Stagger animations for tiles */
.role-tile:nth-child(1) { animation-delay: 0.1s; }
.role-tile:nth-child(2) { animation-delay: 0.15s; }
.role-tile:nth-child(3) { animation-delay: 0.2s; }
.role-tile:nth-child(4) { animation-delay: 0.25s; }
.role-tile:nth-child(5) { animation-delay: 0.3s; }
.role-tile:nth-child(6) { animation-delay: 0.35s; }
.role-tile:nth-child(7) { animation-delay: 0.4s; }

/* ═══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════ */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
