@tailwind base;
@tailwind components;
@tailwind utilities;

/* Base & Resets to Eliminate Mobile Viewport Overflow (Android & iOS) */
html { 
    max-width: 100%;
    overflow-x: hidden !important;
    position: relative;
    width: 100%;
}

body { 
    background-color: #030303; 
    color: #ededed; 
    overflow-x: hidden !important; 
    max-width: 100%;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
}

*, ::before, ::after {
    box-sizing: border-box;
}

::selection { background: rgba(6, 182, 212, 0.3); color: #fff; }

/* Font Helper */
.font-poppins { font-family: 'Poppins', sans-serif; }

/* Loading Screen */
#loader { transition: opacity 0.6s cubic-bezier(0.83, 0, 0.17, 1); }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-top-color: #06b6d4; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Scroll Progress */
#scroll-progress { transform-origin: left; will-change: transform; }

/* Premium Glassmorphism & Liquid Glass Surfaces */
.glass-panel {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transform-style: preserve-3d;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-width: 100%;
}
.glass-panel:hover { border-color: rgba(255,255,255,0.15); }
.glass-panel-3d-content { transform: translateZ(40px); }

/* Grid Background */
.bg-grid {
    background-size: 50px 50px;
    background-image: linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
    mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
}

/* Ambient Lights */
.aurora-glow {
    position: absolute; 
    filter: blur(120px); 
    opacity: 0.4; 
    z-index: -1; 
    pointer-events: none; 
    will-change: transform;
    max-width: 100vw;
}

/* Nav Base Styling */
#navbar {
    border-bottom: 1px solid transparent;
    transition: background-color 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), 
                border-color 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), 
                padding 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nav-scrolled { 
    background: rgba(3, 3, 3, 0.85); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    border-bottom-color: rgba(255, 255, 255, 0.08); 
}

.nav-link { position: relative; }
.nav-link::after { content: ''; position: absolute; width: 0; height: 2px; bottom: -4px; left: 0; background: #06b6d4; transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.nav-link:hover::after { width: 100%; }

/* Form Inputs - Longhand Padding to Allow Icon Padding Overrides */
.form-input {
    width: 100%; 
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem; 
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    color: white; 
    outline: none; 
    transition: all 0.3s ease;
}
.form-input:focus { border-color: #06b6d4; background: rgba(255, 255, 255, 0.05); box-shadow: 0 0 20px rgba(6, 182, 212, 0.15); }

/* Timeline Connector */
.timeline-line { background: linear-gradient(to bottom, #06b6d4, #a855f7, #f59e0b); }

/* Accordion */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] summary ~ * { animation: sweep .4s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes sweep { 0% { opacity: 0; transform: translateY(-8px); } 100% { opacity: 1; transform: translateY(0); } }

/* Seamless Infinite Marquee Keyframe */
@keyframes marquee {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-50%); }
}

.animate-marquee {
    display: flex;
    width: max-content;
    will-change: transform;
    animation: marquee 25s linear infinite;
}

.animate-marquee:hover {
    animation-play-state: paused;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #030303; }
::-webkit-scrollbar-thumb { background: #222; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* View Transitions */
.app-view {
    opacity: 0;
    transform: translateY(10px);
    will-change: opacity, transform;
    transition: opacity 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), 
                transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.app-view.view-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Skeleton Loading */
.skeleton-line {
    width: 100%; height: 12px; background: linear-gradient(90deg, #090909 25%, #161616 50%, #090909 75%);
    background-size: 200% 100%; border-radius: 4px; animation: skeletonMotion 1.5s infinite linear;
}
@keyframes skeletonMotion { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Organizational Tree Styling */
.tree-node-wrapper { margin-left: 1.25rem; border-left: 1px dashed rgba(255, 255, 255, 0.08); padding-left: 1rem; position: relative; }
.tree-node-wrapper::before { content: ''; position: absolute; left: 0; top: 18px; width: 10px; height: 1px; border-bottom: 1px dashed rgba(255, 255, 255, 0.08); }

/* AOS Fix */
[data-aos] {
    max-width: 100%;
}

/* Mobile Viewport Refinements */
@media (max-width: 767px) {
    section {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .glass-panel {
        padding: 1.15rem !important;
        border-radius: 1.25rem !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        max-width: 100% !important;
    }

    .form-input {
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
        font-size: 0.8125rem !important;
        border-radius: 0.625rem !important;
    }

    #modal-login #login-card,
    #modal-admin-crud > div,
    #modal-directory-crud > div,
    #modal-employee-detail > div {
        border-radius: 1.25rem !important;
        max-height: 90vh !important;
        width: 95% !important;
        margin: 0 auto !important;
    }

    .aurora-glow {
        width: 280px !important;
        height: 280px !important;
        filter: blur(60px) !important;
        opacity: 0.25 !important;
    }

    .tree-node-wrapper {
        margin-left: 0.5rem !important;
        padding-left: 0.5rem !important;
    }

    .tree-node-wrapper::before {
        width: 6px !important;
    }

    ::-webkit-scrollbar {
        width: 3px;
        height: 3px;
    }
}