/**
 * Custom Styles
 * Additional styles for the application
 */

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    z-index: 1001;
}

/* RGB Frame Animation - Slower and smoother */
@keyframes rgb-border {
    0% { border-color: #ff0000; }
    16.66% { border-color: #ff7f00; }
    33.33% { border-color: #ffff00; }
    50% { border-color: #00ff00; }
    66.66% { border-color: #0000ff; }
    83.33% { border-color: #4b0082; }
    100% { border-color: #9400d3; }
}

.rgb-frame {
    border: 3px solid;
    animation: rgb-border 5s linear infinite;
}

/* Dynamic Animated Border - Generated via JavaScript/CSS variables */
.ad-animated-gradient_flow,
.ad-animated-pulse,
.ad-animated-rainbow,
.ad-animated-custom {
    border: 4px solid;
    border-radius: 1rem;
    animation-duration: var(--anim-duration, 4s);
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

/* Grid/Flex child overflow fix (safe) */
.grid > * {
    min-width: 0;
}

/* Card Hover Effect */
.card-hover {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Mobile First Adjustments */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Focus Styles */
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    z-index: 10;
    position: relative;
    background-color: white !important;
}

/* Ensure elements stay visible when form is focused */
input:focus ~ *,
select:focus ~ *,
input:focus + *,
select:focus + * {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Prevent backdrop-blur from affecting child elements visibility */
input:focus,
select:focus,
textarea:focus {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Ensure header elements stay visible */
#header-main-row,
#header-main-row > *,
#header-main-row a,
#header-main-row button,
#header-main-row img,
#header-main-row svg {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Group cards stay visible */
.group,
.group > *,
.group img,
.group svg,
.group h3,
.group a,
.group div {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Prevent backdrop-blur from causing issues on form focus */
body:has(input:focus) #header-main-row,
body:has(select:focus) #header-main-row,
body:has(textarea:focus) #header-main-row {
    opacity: 1 !important;
    visibility: visible !important;
}

body:has(input:focus) .group,
body:has(select:focus) .group,
body:has(textarea:focus) .group {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Alternative for browsers that don't support :has() */
input:focus,
select:focus,
textarea:focus {
    isolation: isolate;
}

/* Ensure parent containers stay visible */
form:has(input:focus),
form:has(select:focus) {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Custom Scrollbar for category groups */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #6366f1, #8b5cf6);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #4f46e5, #7c3aed);
}

/* Advertisement Styles */
.ad-rgb-border {
    border: 4px solid;
    animation: rgb-border 5s linear infinite;
    border-radius: 1rem;
}

/* Dynamic animation keyframes will be injected by JavaScript */

/* Featured Badge Animation */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

.ad-featured-badge {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ============================================
   UTILITY CLASSES - Inline Styles Replacement
   ============================================ */

/* Zero Spacing Utilities */
.reset-spacing,
.reset-spacing * {
    margin: 0 !important;
    padding: 0 !important;
}

.reset-margin {
    margin: 0 !important;
}

.reset-padding {
    padding: 0 !important;
}

.reset-margin-top {
    margin-top: 0 !important;
}

.reset-padding-top {
    padding-top: 0 !important;
}

/* Display Utilities */
.display-block {
    display: block !important;
}

.display-flex {
    display: flex !important;
}

.display-inline-block {
    display: inline-block !important;
}

.display-inline-flex {
    display: inline-flex !important;
}

.display-none {
    display: none !important;
}

/* Text Decoration */
.no-decoration {
    text-decoration: none !important;
}

/* Color Utilities */
.text-white-important {
    color: #ffffff !important;
}

.text-gray-700-important {
    color: #374151 !important;
}

.text-gray-600-important {
    color: #4b5563 !important;
}

.text-indigo-700-important {
    color: #4338ca !important;
}

/* Background Color Utilities */
.bg-gray-600-important {
    background-color: #4b5563 !important;
}

.bg-gray-200-important {
    background-color: #e5e7eb !important;
}

/* Group Card Specific Styles */
.group-card-container {
    margin: 0 !important;
    padding: 0 !important;
}

.group-card-link {
    margin: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
    display: block !important;
}

.group-card-image-container {
    margin: 0 !important;
    padding: 0 !important;
}

.group-card-image {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.group-card-placeholder {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
}

.group-card-placeholder-icon {
    display: block !important;
}

.group-card-overlay {
    margin: 0 !important;
    padding: 0 !important;
}

.group-card-badge-container {
    margin: 0 !important;
    padding: 0 !important;
}

.group-card-badge {
    margin: 0 !important;
    padding: 0.25rem 0.75rem !important;
    text-decoration: none !important;
    display: inline-block !important;
}

.group-card-badge-flex {
    margin: 0 !important;
    padding: 0.25rem 0.75rem !important;
    display: inline-flex !important;
}

.group-card-title-overlay {
    margin: 0 !important;
    padding: 1rem !important;
}

.group-card-title {
    margin: 0 !important;
    padding: 0 !important;
    color: #111827 !important;
}

.group-card-content {
    margin: 0 !important;
    padding: 1rem !important;
    background: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(8px) !important;
}

.group-card-stats-row {
    margin: 0 0 0.75rem 0 !important;
    padding: 0 !important;
}

.group-card-stat-item {
    margin: 0 !important;
    padding: 0 !important;
}

.group-card-footer {
    margin-top: auto !important;
    padding-top: 0.75rem !important;
}

.group-card-footer-tag {
    margin: 0 !important;
    padding: 0.375rem 0.75rem !important;
    display: inline-block !important;
    background: linear-gradient(to right, #e0e7ff, #f3e8ff) !important;
    color: #4338ca !important;
}

.group-card-footer-icon {
    margin: 0 !important;
    padding: 0 !important;
}

/* Section Spacing */
.section-compact {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.section-header {
    margin-bottom: 1rem !important;
}

.section-title {
    margin-bottom: 0.5rem !important;
}

.section-description {
    margin-bottom: 0 !important;
}

.section-grid {
    margin: 0 !important;
    padding: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Blog Prose Styles (moved from blog/index.php) */
.prose {
    color: #374151;
}

.prose h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #111827;
}

.prose h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

.prose p {
    margin-bottom: 1.25rem;
    line-height: 1.75;
}

.prose ul, .prose ol {
    margin-bottom: 1.25rem;
    padding-left: 1.625rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose a {
    color: #2563eb;
    text-decoration: underline;
}

.prose a:hover {
    color: #1d4ed8;
}

.prose strong {
    font-weight: 600;
    color: #111827;
}

/* Footer Pattern Background */
.footer-pattern {
    background-image: radial-gradient(circle at 2px 2px, white 1px, transparent 0);
    background-size: 40px 40px;
}

/* User Menu Dropdown */
.user-menu-dropdown {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    z-index: 1000;
}

.user-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.user-menu-item {
    pointer-events: auto !important;
    position: relative;
    z-index: 1001;
}

/* Progress Bar */
.progress-bar {
    width: 0%;
    transition: width 0.3s ease;
}

/* Form Input Styles */
.form-input {
    margin: 0;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
}

.form-textarea {
    min-height: 120px;
    margin: 0;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    resize: vertical;
}

/* Cursor Pointer */
.cursor-pointer {
    cursor: pointer !important;
}

/* Backdrop Blur */
.backdrop-blur-light {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
}

/* Section Spacing Utilities */
.section-mt-compact {
    margin-top: 1rem !important;
}

.section-mb-compact {
    margin-bottom: 1rem !important;
}

.section-title-mb {
    margin-bottom: 0.5rem !important;
}

.section-desc-mb-none {
    margin-bottom: 0 !important;
}

/* Hero Section Grid */
.hero-grid {
    margin: 0 !important;
    padding: 0 !important;
}

/* Display None Utility */
.display-none {
    display: none !important;
}

/* Hide scrollbar utility (used by hero chips, admin pills, etc.) */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

