/**
 * MyPPRQ Enhanced CSS
 * [AI MODIFIED] Performance optimizations dan accessibility improvements
 * Tidak mengganti existing styling, hanya menambahkan enhancements
 */

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus indicators untuk keyboard navigation */
.login-form .button:focus,
.socmed-btn:focus,
.input:focus {
    outline: 2px solid #3ea884 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(62, 168, 132, 0.3) !important;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #3ea884;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 4px;
    font-size: 14px;
}

.skip-link:focus {
    top: 0;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* [AI MODIFIED] Lazy loading untuk images */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[data-src].loaded {
    opacity: 1;
}

/* Preload hint untuk critical resources */
.preload-hint {
    display: none;
}

/* ===== ENHANCED INTERACTIONS ===== */

/* Improved button hover states */
.login-form .button {
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.login-form .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.login-form .button:active {
    transform: translateY(0);
    transition: all 0.1s;
}

/* Enhanced social media buttons */
.socmed-btn {
    transition: all 0.2s ease-in-out;
    position: relative;
}

.socmed-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Loading state for buttons */
.socmed-btn.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.socmed-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== SEARCH ENHANCEMENTS ===== */

/* Enhanced search container */
.search-container {
    position: relative;
}

.search-hint {
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 11px;
    color: #666;
    margin-top: 5px;
    line-height: 1.3;
}

.input:focus + .search-hint {
    opacity: 1;
}

/* Search results counter */
.search-results-info {
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

.no-results i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
    opacity: 0.5;
}

/* ===== LOADING STATES ===== */

/* Custom loader */
#mypprq-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(62, 168, 132, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#mypprq-loader .loader-content {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

#mypprq-loader i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}

/* Page transition */
.page-transition {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.page-transition.fade-out {
    opacity: 0;
}

/* ===== RESPONSIVE ENHANCEMENTS ===== */

/* Enhanced mobile experience */
@media screen and (max-width: 400px) {
    /* Improve touch targets */
    .socmed-btn {
        min-height: 44px;
        padding: 12px 16px;
        margin-bottom: 8px;
    }
    
    .login-form .button {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .input {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 44px;
    }
    
    /* Adjust spacing for mobile */
    .search-hint {
        font-size: 10px;
        margin-top: 3px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .login-form-content {
        border: 2px solid #000;
    }
    
    .socmed-btn {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .socmed-btn:hover {
        transform: none;
    }
    
    .login-form .button:hover {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .search-hint {
        color: #ccc;
    }
    
    .search-results-info {
        color: #999;
    }
}

/* ===== ANIMATIONS ===== */

/* Fade in animation for dynamic content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spin animation for loading */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulse animation for loading states */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Scale animation for interactions */
@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Apply animations to new elements */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.2s ease-out;
}

.animate-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ===== UTILITY CLASSES ===== */

/* Text utilities */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-small {
    font-size: 0.875em;
}

.text-muted {
    color: #666;
}

/* Spacing utilities */
.mb-small { margin-bottom: 0.5rem; }
.mt-small { margin-top: 0.5rem; }
.p-small { padding: 0.5rem; }

/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }

/* Flexbox utilities */
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.flex-column { flex-direction: column; }

/* Position utilities */
.position-relative { position: relative; }
.position-absolute { position: absolute; }

/* ===== PRINT STYLES ===== */

@media print {
    /* Hide interactive elements when printing */
    .socmed-btn,
    .login-form,
    #mypprq-loader {
        display: none !important;
    }
    
    /* Optimize text for print */
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .logo h1, .logo h2 {
        color: #000 !important;
        text-shadow: none !important;
    }
}

/* ===== CUSTOM PROPERTIES FOR THEMING ===== */

:root {
    --mypprq-primary: #3ea884;
    --mypprq-primary-dark: #2d7a5f;
    --mypprq-primary-light: #4fb896;
    --mypprq-text: #333;
    --mypprq-text-muted: #666;
    --mypprq-bg: #f9f9f9;
    --mypprq-border: #e1e1e1;
    --mypprq-shadow: rgba(0, 0, 0, 0.1);
    --mypprq-radius: 5px;
    --mypprq-transition: all 0.2s ease-in-out;
}

/* Apply custom properties where appropriate */
.backdrop {
    background: var(--mypprq-primary) !important;
}

.login-form .button {
    background: var(--mypprq-primary);
    transition: var(--mypprq-transition);
}

.login-form .button:hover {
    background: var(--mypprq-primary-dark);
}

/* ===== ACCESSIBILITY IMPROVEMENTS FOR ICONS ===== */

/* Ensure icons have proper labels */
.fa::before {
    speak: none; /* Prevent screen readers from reading icon codes */
}

/* Add proper labels for social media links */
.fa-globe::after {
    content: " (Website)";
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
}

.fa-instagram::after {
    content: " (Instagram)";
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
}

.fa-youtube::after {
    content: " (YouTube)";
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
}