/* ========================================
   PPIC Dashboard - WKB Styles
   ======================================== */

/* ========================================
   1. BASE STYLES & RESETS
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #f9fafb;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   2. GRADIENT BACKGROUNDS
   ======================================== */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* ========================================
   3. GLASS EFFECT (GLASSMORPHISM)
   ======================================== */
.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.3s ease;
}

.glass-effect:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
}

/* ========================================
   4. CARD HOVER EFFECTS
   ======================================== */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card-hover::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-hover:hover::after {
    width: 300px;
    height: 300px;
}

.card-hover:active {
    transform: translateY(-4px) scale(1.01);
}

/* ========================================
   5. ANIMATIONS
   ======================================== */

/* Pulse Animation */
.pulse-animation {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Bounce Animation */
.animate-bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* Ping Animation */
.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Scale In Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.4s ease-out forwards;
}

/* ========================================
   6. MODAL STYLES
   ======================================== */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.modal-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-backdrop.flex {
    opacity: 1;
    pointer-events: auto;
}

/* Modal Content Animation */
.modal-backdrop .glass-effect {
    animation: modalSlideUp 0.4s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   7. FLOATING ACTION BUTTON
   ======================================== */
.floating-action {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 40;
    animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.floating-action button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.floating-action button:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.floating-action button:active {
    transform: scale(1.05) rotate(180deg);
}

/* ========================================
   8. HEADER STYLES
   ======================================== */
header {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

header.sticky {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Logo Animation */
.logo-container {
    position: relative;
    overflow: hidden;
}

.logo-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: logoShine 3s ease-in-out infinite;
}

@keyframes logoShine {
    0% {
        left: -50%;
    }
    50% {
        left: 150%;
    }
    100% {
        left: -50%;
    }
}

/* ========================================
   9. BUTTON STYLES
   ======================================== */
button {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before {
    width: 300px;
    height: 300px;
}

button:active {
    transform: scale(0.98);
}

/* Gradient Button */
.btn-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

/* ========================================
   10. CARD ICON STYLES
   ======================================== */
.icon-container {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.icon-container svg {
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.card-hover:hover .icon-container {
    transform: scale(1.1) rotate(3deg);
}

.card-hover:hover .icon-container svg {
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.15));
}

/* ========================================
   11. PROGRESS BAR
   ======================================== */
.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ========================================
   12. SCROLLBAR STYLES
   ======================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ========================================
   13. MOBILE MENU
   ======================================== */
.mobile-menu-btn {
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

#mobileMenu {
    animation: slideDown 0.3s ease-out;
    transform-origin: top;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#mobileMenu.hidden {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ========================================
   14. RESPONSIVE UTILITIES
   ======================================== */
@media (max-width: 640px) {
    .floating-action {
        bottom: 20px;
        right: 20px;
    }
    
    .card-hover:hover {
        transform: translateY(-4px) scale(1.01);
    }
}

@media (max-width: 768px) {
    .glass-effect {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

/* ========================================
   15. LOADING STATES
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   16. FOCUS STATES (Accessibility)
   ======================================== */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.5);
}

/* ========================================
   17. PRINT STYLES
   ======================================== */
@media print {
    .floating-action,
    .mobile-menu-btn,
    #mobileMenu,
    header {
        display: none !important;
    }
    
    .glass-effect {
        box-shadow: none;
        background: white;
    }
    
    .card-hover {
        page-break-inside: avoid;
    }
}

/* ========================================
   18. DARK MODE SUPPORT (Optional)
   ======================================== */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode */
    /*
    body {
        background-color: #1a202c;
        color: #e2e8f0;
    }
    
    .glass-effect {
        background: rgba(45, 55, 72, 0.9);
        color: #e2e8f0;
    }
    
    .gradient-bg {
        background: linear-gradient(135deg, #4c51bf 0%, #553c9a 100%);
    }
    */
}

/* ========================================
   19. UTILITY CLASSES
   ======================================== */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.border-gradient {
    border: 2px solid transparent;
    background-image: linear-gradient(white, white), linear-gradient(135deg, #667eea, #764ba2);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

/* ========================================
   20. TRANSITIONS
   ======================================== */
.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-bounce {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========================================
   21. Z-INDEX MANAGEMENT
   ======================================== */
.z-header {
    z-index: 50;
}

.z-modal {
    z-index: 999;
}

.z-floating {
    z-index: 40;
}

.z-dropdown {
    z-index: 30;
}

/* ========================================
   22. GRID LAYOUTS
   ======================================== */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.grid-auto-fill {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* ========================================
   23. SVG ICON ANIMATIONS
   ======================================== */
svg {
    transition: all 0.3s ease;
}

.icon-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.icon-pulse {
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

/* ========================================
   24. BADGE STYLES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    transition: all 0.3s ease;
}

.badge-success {
    background-color: #10b981;
    color: white;
}

.badge-warning {
    background-color: #f59e0b;
    color: white;
}

.badge-error {
    background-color: #ef4444;
    color: white;
}

.badge-info {
    background-color: #3b82f6;
    color: white;
}

/* ========================================
   25. TOOLTIP (Optional Enhancement)
   ======================================== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ========================================
   26. PWA SPECIFIC STYLES
   ======================================== */

/* Install Banner */
#pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    border-top: 1px solid rgba(102, 126, 234, 0.4);
    padding: 12px 16px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
}

#pwa-install-banner.show {
    transform: translateY(0);
}

/* Offline Banner */
#offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 10px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

#offline-banner.show {
    transform: translateY(0);
}

/* Update Banner */
#update-banner {
    position: fixed;
    top: 70px;
    right: 16px;
    z-index: 9998;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transform: translateX(calc(100% + 20px));
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 280px;
}

#update-banner.show {
    transform: translateX(0);
}

/* PWA Standalone mode adjustments */
@media (display-mode: standalone) {
    header {
        padding-top: env(safe-area-inset-top, 0px);
    }
    body {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .floating-action {
        bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    }
    #pwa-install-banner {
        display: none !important;
    }
}

/* iOS safe area */
@supports (padding: max(0px)) {
    header {
        padding-top: max(0px, env(safe-area-inset-top));
    }
}

/* PWA splash screen feel */
.pwa-splash {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.pwa-splash.hide {
    opacity: 0;
    visibility: hidden;
}

.pwa-splash-content {
    text-align: center;
    color: white;
}

.pwa-splash-logo {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    font-weight: 800;
    backdrop-filter: blur(8px);
    animation: splashPulse 1.5s ease-in-out infinite;
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(255,255,255,0); }
}

.pwa-splash-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.pwa-splash-sub {
    font-size: 13px;
    opacity: 0.8;
}

.pwa-splash-loader {
    margin-top: 24px;
    width: 40px;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 99px;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
}

.pwa-splash-loader::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: white;
    border-radius: 99px;
    animation: splashLoad 1.2s ease-in-out infinite;
}

@keyframes splashLoad {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Network status indicator in header */
.network-status-dot {
    transition: background-color 0.3s ease;
}

.network-status-dot.offline {
    background-color: #ef4444 !important;
    animation: none !important;
}
