/* Main Styles for SabaiTools */
:root {
    --primary-color: #4e73df;
    --secondary-color: #6c757d;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --body-bg: #f8f9fc;
    --body-color: #858796;
    --font-family-sans-serif: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
    --body-bg: #2a3042;
    --body-color: #b7b9c2;
    --light-color: #3a3f51;
    --dark-color: #f8f9fc;
}

body {
    font-family: var(--font-family-sans-serif);
    background-color: var(--body-bg);
    color: var(--body-color);
    line-height: 1.6;
}

/* Header Styles */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand img {
    height: 40px;
}

/* Tool Cards */
.tool-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: none;
    border-radius: 0.5rem;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.category-icon {
    width: 60px;
    height: 60px;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2a3d8f 100%);
}

/* Ad Units */
.ad-unit {
    text-align: center;
    padding: 1rem;
    background: var(--light-color);
    border-radius: 0.5rem;
    border: 1px solid #e3e6f0;
    margin-bottom: 1rem;
}

.ad-unit.header-ad {
    margin-bottom: 1rem;
}

.ad-unit.sidebar-ad {
    margin-bottom: 1.5rem;
}

.ad-unit.footer-ad {
    margin-top: 2rem;
}

.ad-unit img {
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
}

/* Tool Content */
.tool-body {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.tool-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.35rem;
}

/* Dark Mode Support */
[data-theme="dark"] .tool-body {
    background: #3a3f51;
    color: #b7b9c2;
}

[data-theme="dark"] .card {
    background: #3a3f51;
    border-color: #4a4f61;
}

[data-theme="dark"] .card-header {
    background: #2a3042;
    border-color: #4a4f61;
    color: #f8f9fc;
}

[data-theme="dark"] .list-group-item {
    background: #3a3f51;
    border-color: #4a4f61;
    color: #b7b9c2;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: white;
    padding: 8px;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for accessibility */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section .display-4 {
        font-size: 2.5rem;
    }
    
    .tool-body {
        padding: 1rem;
    }
    
    .social-sharing .btn-group {
        flex-wrap: wrap;
    }
    
    .social-sharing .btn {
        margin-bottom: 0.5rem;
    }
    
    .ad-unit {
        margin: 1rem 0;
    }
}

/* Lazy Loading */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

img.lazy.loaded {
    opacity: 1;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* Utility Classes */
.text-small {
    font-size: 0.875rem;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.rounded-lg {
    border-radius: 0.5rem;
}

/* Theme Toggle */
.theme-toggle {
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--body-color);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Pages */
.error-container {
    padding: 3rem 0;
}

/* Print Styles */
@media print {
    .navbar, .footer, .ad-unit {
        display: none !important;
    }
    
    .tool-body {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}