/**
 * Enhanced Main CSS for OmniCalculator
 * Complements Bootstrap 5.3.2 with custom styles
 */

/* ==========================================
   1. Custom Properties (CSS Variables)
   ========================================== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --transition-base: all 0.3s ease;
}

/* ==========================================
   2. Global Styles
   ========================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    transition: var(--transition-base);
}

/* ==========================================
   3. Gradient Backgrounds
   ========================================== */
.bg-gradient-primary {
    background: var(--primary-gradient) !important;
}

.bg-gradient-success {
    background: var(--success-gradient) !important;
}

.bg-gradient-danger {
    background: var(--danger-gradient) !important;
}

/* ==========================================
   4. Custom Animations
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* ==========================================
   5. Hover Effects
   ========================================== */
.hover-lift {
    transition: var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg) !important;
}

.hover-shadow:hover {
    box-shadow: var(--shadow-md) !important;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ==========================================
   6. Card Enhancements
   ========================================== */
.card {
    border-radius: 0.5rem;
    overflow: hidden;
}

.card-hover {
    transition: var(--transition-base);
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* ==========================================
   7. Button Enhancements
   ========================================== */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: var(--transition-base);
}

.btn-gradient-primary {
    background: var(--primary-gradient);
    border: none;
    color: white;
}

.btn-gradient-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==========================================
   8. AdSense Ad Slots (Placeholders)
   ========================================== */
.ad-slot {
    min-height: 250px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    border-radius: 0.5rem;
}

.ad-slot::before {
    content: 'Advertisement';
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-slot-sidebar {
    min-height: 600px;
}

.ad-slot-banner {
    min-height: 90px;
}

.ad-slot-leaderboard {
    min-height: 90px;
}

/* Ensure proper spacing around ads */
.ad-container {
    margin: 2rem 0;
    padding: 1rem 0;
}

/* ==========================================
   9. Calculator Specific Styles
   ========================================== */
.calculator-container {
    background: #ffffff;
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.calculator-input {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
    transition: var(--transition-base);
}

.calculator-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.calculator-result {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 1.5rem;
    border-radius: 0.375rem;
    font-size: 1.25rem;
    font-weight: 600;
}

/* ==========================================
   10. Loading States
   ========================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.375rem;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ==========================================
   11. Breadcrumbs Enhancement
   ========================================== */
.breadcrumb {
    background: #f8f9fa;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
}

/* ==========================================
   12. Badge Enhancements
   ========================================== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
}

.badge-gradient {
    background: var(--primary-gradient);
    color: white;
}

/* ==========================================
   13. Alert Enhancements
   ========================================== */
.alert {
    border-radius: 0.5rem;
    border-left-width: 4px;
}

/* ==========================================
   14. Form Enhancements
   ========================================== */
.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* ==========================================
   15. Image Lazy Loading
   ========================================== */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ==========================================
   16. Back to Top Button
   ========================================== */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
    z-index: 1000;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    transform: translateY(-5px);
}

/* ==========================================
   17. Print Styles
   ========================================== */
@media print {
    .no-print,
    nav,
    footer,
    .btn,
    .ad-slot {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ==========================================
   18. Responsive Utilities
   ========================================== */
@media (max-width: 767.98px) {
    h1 {
        font-size: 2rem;
    }
    
    .display-1 {
        font-size: 3rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
}

/* ==========================================
   19. Accessibility Enhancements
   ========================================== */
.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 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ==========================================
   20. Custom Scrollbar
   ========================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==========================================
   21. Typography Enhancements
   ========================================== */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lead {
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.7;
}

/* ==========================================
   22. Utility Classes
   ========================================== */
.cursor-pointer {
    cursor: pointer;
}

.object-fit-cover {
    object-fit: cover;
}

.overflow-hidden {
    overflow: hidden;
}

.position-relative {
    position: relative;
}

/* ==========================================
   23. Custom Page Classes
   ========================================== */
.container-page {
    max-width: 1200px;
    margin: 0 auto;
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.font-display {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 700;
}

.card-calculator {
    background: #ffffff;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e5e7eb;
    transition: var(--transition-base);
}

@media (min-width: 640px) {
    .card-calculator {
        padding: 2rem;
    }
}

.card-calculator:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.prose-content {
    max-width: none;
}

.prose-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #1f2937;
}

.prose-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

.prose-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: #4b5563;
}

.prose-content ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.prose-content li {
    margin-bottom: 0.5rem;
}

.prose-content a {
    color: #667eea;
    text-decoration: underline;
}

.prose-content a:hover {
    color: #5a67d8;
}

/* ==========================================
   24. Dark Mode Support (Optional)
   ========================================== */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    body {
        background: #1a1a1a;
        color: #f0f0f0;
    }
    
    .card {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }
    
    .form-control,
    .form-select {
        background: #2a2a2a;
        border-color: #3a3a3a;
        color: #f0f0f0;
    }
    */
}
