/* Custom Styles for EarnLiveApps */

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #2E7D32 0%, #66BB6A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Reveal Animation */
.reveal, .will-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.revealed, .will-animate.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Slide In Animation for Flash Messages */
@keyframes slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slide-in {
    animation: slide-in 0.3s ease-out;
}

/* Shake Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

/* Fade In */
@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

/* Scale In */
@keyframes scale-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-scale-in {
    animation: scale-in 0.3s ease-out;
}

/* Rotate */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-rotate {
    animation: rotate 1s linear infinite;
}

/* Smooth Transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #F5F5F5;
}

::-webkit-scrollbar-thumb {
    background: #2E7D32;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1B5E20;
}

/* Button Hover Effects */
button, a {
    transition: all 0.3s ease;
}

button:active {
    transform: scale(0.98);
}

/* Card Hover Effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Focus Styles */
input:focus, textarea:focus, select:focus {
    outline: none;
    ring: 2px;
    ring-color: #2E7D32;
    border-color: #2E7D32;
}

/* Disabled State */
button:disabled, input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error State */
.border-error {
    border-color: #C62828 !important;
}

.border-error:focus {
    ring-color: #C62828 !important;
}

/* Success State */
.border-success {
    border-color: #388E3C !important;
}

/* Skeleton Loading */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 0px, #e0e0e0 40px, #f0f0f0 80px);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Progress Bar Animation */
.progress-bar {
    transition: width 0.5s ease-out;
}

/* Tooltip */
.tooltip {
    white-space: nowrap;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
}

/* Modal Overlay */
.modal-overlay {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Ripple Effect */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* Stagger Animation Delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Image Zoom on Hover */
.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform 0.5s ease;
}

.image-zoom:hover img {
    transform: scale(1.1);
}

/* Text Selection */
::selection {
    background-color: #2E7D32;
    color: white;
}

::-moz-selection {
    background-color: #2E7D32;
    color: white;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .desktop-hidden {
        display: none !important;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible (for keyboard navigation) */
*:focus-visible {
    outline: 2px solid #2E7D32;
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* Additional Tailwind-style utilities */

/* Line clamp utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Opacity utilities with slash notation */
.bg-primary\/10 {
    background-color: rgba(46, 125, 50, 0.1);
}

.bg-primary\/90 {
    background-color: rgba(46, 125, 50, 0.9);
}

.bg-success\/10 {
    background-color: rgba(56, 142, 60, 0.1);
}

.bg-success\/90 {
    background-color: rgba(56, 142, 60, 0.9);
}

.bg-secondary\/10 {
    background-color: rgba(121, 85, 72, 0.1);
}

.bg-accent\/10 {
    background-color: rgba(255, 193, 7, 0.1);
}

.bg-muted\/80 {
    background-color: rgba(245, 245, 245, 0.8);
}

.hover\:bg-primary\/90:hover {
    background-color: rgba(46, 125, 50, 0.9);
}

.hover\:bg-success\/90:hover {
    background-color: rgba(56, 142, 60, 0.9);
}

.hover\:bg-muted\/80:hover {
    background-color: rgba(245, 245, 245, 0.8);
}

.text-primary\/80 {
    color: rgba(46, 125, 50, 0.8);
}

.hover\:text-primary\/80:hover {
    color: rgba(46, 125, 50, 0.8);
}

/* Card shadow utilities */
.shadow-card {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.hover\:shadow-lg:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
/* Background color utilities without slashes */
.bg-success-10 {
    background-color: rgba(56, 142, 60, 0.1);
}

.bg-primary-10 {
    background-color: rgba(46, 125, 50, 0.1);
}

.bg-secondary-10 {
    background-color: rgba(121, 85, 72, 0.1);
}

.bg-accent-10 {
    background-color: rgba(255, 193, 7, 0.1);
}

.bg-primary-90 {
    background-color: rgba(46, 125, 50, 0.9);
}

.bg-success-90 {
    background-color: rgba(56, 142, 60, 0.9);
}

.bg-muted-80 {
    background-color: rgba(245, 245, 245, 0.8);
}

.hover-bg-primary-90:hover {
    background-color: rgba(46, 125, 50, 0.9);
}

.hover-bg-success-90:hover {
    background-color: rgba(56, 142, 60, 0.9);
}

.hover-bg-muted-80:hover {
    background-color: rgba(245, 245, 245, 0.8);
}
/* Hover utilities */
.hover\:bg-primary-90:hover {
    background-color: rgba(46, 125, 50, 0.9) !important;
}

.hover\:bg-success-90:hover {
    background-color: rgba(56, 142, 60, 0.9) !important;
}

.hover\:bg-muted-80:hover {
    background-color: rgba(245, 245, 245, 0.8) !important;
}


/* Phase 8A: Enhanced App Card Styles */
.app-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-card:hover {
    transform: translateY(-4px);
}

.app-card img {
    transition: transform 0.3s ease;
}

.app-card:hover img {
    transform: scale(1.05);
}

/* Line clamp utility for text truncation */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Smooth fade transitions for filtering */
.app-card {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.app-card.hiding {
    opacity: 0;
    transform: scale(0.95);
}

/* Badge animations */
@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.app-card .bg-green-500,
.app-card .bg-red-500 {
    animation: badge-pulse 2s ease-in-out infinite;
}

/* Ensure images don't break layout */
.app-card img {
    min-height: 192px; /* h-48 */
    background-color: #f3f4f6; /* gray-100 fallback */
}


/* Phase 8C: Learning Hub Enhancements */

/* Material card transitions */
.material-card {
    transition: opacity 0.4s ease-in-out, transform 0.3s ease;
}

.material-card.hiding {
    opacity: 0;
    transform: scale(0.95);
}

/* Video play button hover effect */
.material-card .group:hover .w-16 {
    animation: pulse-scale 1s ease-in-out infinite;
}

@keyframes pulse-scale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Video modal animations */
#videoModal {
    animation: fadeIn 0.3s ease-out;
}

#videoModal > div {
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Category tab smooth transitions */
.category-tab {
    transition: all 0.3s ease;
}

.category-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Video badge pulse */
.material-card .bg-red-500 {
    animation: badge-pulse 2s ease-in-out infinite;
}

/* Ensure smooth image transitions */
.material-card img {
    transition: transform 0.5s ease;
}

/* Modal backdrop blur effect */
#videoModal {
    backdrop-filter: blur(4px);
}


/* ============================================================================
   MOBILE RESPONSIVE IMPROVEMENTS
   Enhances UI/UX on small devices without changing colors or structure
   Added: 2024 - Mobile-First Enhancements
   ============================================================================ */

/* ============================================================================
   1. TYPOGRAPHY - Responsive Font Sizes
   ============================================================================ */

/* Base font size adjustments for mobile */
@media (max-width: 640px) {
    html {
        font-size: 14px; /* Slightly smaller base for mobile */
    }
    
    h1, .text-3xl, .text-4xl, .text-5xl {
        font-size: 1.75rem !important; /* ~28px */
        line-height: 1.3 !important;
    }
    
    h2, .text-2xl {
        font-size: 1.5rem !important; /* ~24px */
        line-height: 1.3 !important;
    }
    
    h3, .text-xl {
        font-size: 1.25rem !important; /* ~20px */
        line-height: 1.4 !important;
    }
    
    .text-lg {
        font-size: 1.125rem !important; /* ~18px */
    }
    
    .text-base {
        font-size: 1rem !important; /* ~16px */
    }
    
    .text-sm {
        font-size: 0.875rem !important; /* ~14px */
    }
    
    .text-xs {
        font-size: 0.75rem !important; /* ~12px */
    }
}

/* ============================================================================
   2. TEXT WRAPPING & OVERFLOW PREVENTION
   ============================================================================ */

/* Prevent text overflow on all text elements */
p, span, div, a, button, label {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Specific fixes for common overflow issues */
.card-title, .app-name, .user-name {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Truncate long text with ellipsis */
.truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .truncate-mobile {
        max-width: 100%;
    }
}

/* ============================================================================
   3. SPACING & PADDING - Mobile Optimized
   ============================================================================ */

@media (max-width: 640px) {
    /* Reduce container padding on mobile */
    .container, .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Reduce card padding */
    .bg-card, .card, [class*="rounded-lg"].p-6,
    [class*="rounded-xl"].p-6, [class*="rounded-lg"].p-8 {
        padding: 1rem !important;
    }
    
    /* Reduce section spacing */
    .py-8 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .mb-8 {
        margin-bottom: 1.5rem !important;
    }
    
    .mb-6 {
        margin-bottom: 1rem !important;
    }
    
    /* Reduce gap in grids */
    .gap-6 {
        gap: 1rem !important;
    }
    
    .gap-8 {
        gap: 1.5rem !important;
    }
}

/* ============================================================================
   4. BUTTONS - Touch-Friendly
   ============================================================================ */

@media (max-width: 640px) {
    /* Minimum touch target size (44x44px recommended) */
    button, .btn, a.button, input[type="submit"], input[type="button"] {
        min-height: 44px !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Full-width buttons on mobile for better usability */
    button[type="submit"], .btn-primary, .btn-block {
        width: 100% !important;
        display: block !important;
    }
    
    /* Icon buttons maintain square shape */
    button.w-10, button.w-12, button.h-10, button.h-12 {
        width: 44px !important;
        height: 44px !important;
    }
}

/* ============================================================================
   5. CARDS - Responsive Layout
   ============================================================================ */

@media (max-width: 640px) {
    /* Single column layout for cards */
    .grid-cols-2, .grid-cols-3, .grid-cols-4,
    .md\:grid-cols-2, .md\:grid-cols-3, .lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    /* Card image height adjustment */
    .card img, .app-card img {
        max-height: 200px !important;
        object-fit: cover !important;
    }
    
    /* Card content spacing */
    .card-body, .card-content {
        padding: 1rem !important;
    }
    
    /* Prevent card overflow */
    .card, .bg-card, [class*="rounded"] {
        overflow: hidden !important;
    }
}

/* ============================================================================
   6. FORMS - Mobile Optimized
   ============================================================================ */

@media (max-width: 640px) {
    /* Full-width form inputs */
    input, textarea, select {
        width: 100% !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
    }
    
    /* Stack form groups vertically */
    .grid.grid-cols-2 > *, .flex.gap-4 > * {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    /* Label spacing */
    label {
        margin-bottom: 0.5rem !important;
        display: block !important;
    }
}

/* ============================================================================
   7. TABLES - Responsive Tables
   ============================================================================ */

@media (max-width: 768px) {
    /* Reduce table padding */
    table th, table td {
        padding: 0.5rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Make tables scrollable */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ============================================================================
   8. IMAGES - Responsive Images
   ============================================================================ */

@media (max-width: 640px) {
    /* Ensure images don't overflow */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* App/profile images */
    .app-image, .profile-image {
        width: 100% !important;
        max-height: 250px !important;
        object-fit: cover !important;
    }
}

/* ============================================================================
   9. MODALS - Mobile Friendly
   ============================================================================ */

@media (max-width: 640px) {
    /* Full-screen modals on mobile */
    .modal, [role="dialog"] {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    /* Modal content padding */
    .modal-content {
        padding: 1rem !important;
    }
}

/* ============================================================================
   10. STATS & METRICS - Responsive Layout
   ============================================================================ */

@media (max-width: 640px) {
    /* Stack stats vertically */
    .stats-grid, .metrics-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Stat card sizing */
    .stat-value {
        font-size: 1.5rem !important;
    }
    
    .stat-label {
        font-size: 0.875rem !important;
    }
}

/* ============================================================================
   11. NAVIGATION - Mobile Menu
   ============================================================================ */

@media (max-width: 768px) {
    /* Mobile menu items */
    nav a, nav button {
        padding: 0.75rem 1rem !important;
    }
}

/* ============================================================================
   12. FOOTER - Mobile Optimized
   ============================================================================ */

@media (max-width: 640px) {
    footer {
        padding: 2rem 1rem !important;
    }
    
    footer .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* ============================================================================
   13. UTILITY CLASSES - Mobile Specific
   ============================================================================ */

/* Show/hide on mobile */
@media (max-width: 640px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 641px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ============================================================================
   14. TOUCH INTERACTIONS - Enhanced
   ============================================================================ */

/* Larger tap targets */
@media (max-width: 640px) {
    a, button, input[type="checkbox"], input[type="radio"] {
        min-height: 44px !important;
    }
    
    /* Remove hover effects on touch devices */
    @media (hover: none) {
        .hover\:shadow-lg:hover,
        .hover-lift:hover {
            transform: none !important;
            box-shadow: inherit !important;
        }
    }
}

/* ============================================================================
   15. PERFORMANCE - Reduce Animations on Mobile
   ============================================================================ */

@media (max-width: 640px) {
    /* Simplify animations for better performance */
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Disable complex animations */
    .animate-float,
    .animate-bounce {
        animation: none !important;
    }
}

/* ============================================================================
   16. SPECIFIC COMPONENT FIXES
   ============================================================================ */

/* App Cards */
@media (max-width: 640px) {
    .app-card {
        margin-bottom: 1rem !important;
    }
    
    .app-card .flex {
        flex-direction: column !important;
    }
}

/* User Profile */
@media (max-width: 640px) {
    .profile-header {
        flex-direction: column !important;
        text-align: center !important;
    }
}

/* ============================================================================
   17. SAFE AREA - iOS Notch Support
   ============================================================================ */

@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left)) !important;
        padding-right: max(0px, env(safe-area-inset-right)) !important;
    }
}

/* ============================================================================
   END OF MOBILE RESPONSIVE IMPROVEMENTS
   ============================================================================ */

/* ============================================================
   AJAX FORMS - LOADING STATES AND ANIMATIONS
   ============================================================ */

/* Form Loading State */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

/* Disabled Form Elements */
.form-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Spinner Animation (if not already defined) */
.animate-spin {
    animation: spin 1s linear infinite;
}

/* Success State for Buttons */
button.bg-green-600 {
    background-color: #16a34a !important;
    transition: background-color 0.3s ease;
}

/* Flash Message Slide In Animation */
@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slide-in {
    animation: slide-in-right 0.3s ease-out;
}

/* Loading Button Styles */
button[disabled].form-loading {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Smooth Transitions for Form Elements */
form input,
form textarea,
form select,
form button {
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

/* Success Flash Message */
.flash-message {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Ensure spinner SVG is visible */
.form-loading svg {
    display: inline-block;
    vertical-align: middle;
}
