/* Custom styles for Church Business Registry */

:root {
    --church-primary: #4a5568;
    --church-secondary: #718096;
    --church-accent: #e53e3e;
}

/* Dark theme global override */
[data-bs-theme="dark"] {
    --bs-body-color: #ffffff !important;
    --bs-body-bg: #212529 !important;
}

/* Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Cards */
.card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-img-top {
    transition: transform 0.2s ease-in-out;
}

.card:hover .card-img-top {
    transform: scale(1.02);
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease-in-out;
}

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

/* Business cards in directory */
.business-card {
    transition: transform 0.2s ease-in-out;
}

.business-card:hover {
    transform: translateY(-2px);
}

/* Status badges */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

/* Hero section */
.bg-primary {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-info) 100%) !important;
}

/* Footer */
footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Business hours styling */
.business-hours {
    font-size: 0.9rem;
}

/* Photo gallery */
.photo-gallery img {
    border-radius: 0.5rem;
    transition: transform 0.2s ease-in-out;
}

.photo-gallery img:hover {
    transform: scale(1.05);
}

/* Alert styling */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* Pagination */
.pagination .page-link {
    border-radius: 0.375rem;
    margin: 0 0.125rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* Loading states */
.btn.loading {
    position: relative;
    color: transparent;
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem;
    }
    
    .card-body .d-flex.gap-2 {
        flex-direction: column;
    }
    
    .card-body .d-flex.gap-2 .btn {
        width: 100%;
    }
}

/* Dark mode specific adjustments */
[data-bs-theme="dark"] .card {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff !important;
}

[data-bs-theme="dark"] .border-bottom {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Force proper text colors in dark theme */
[data-bs-theme="dark"] body {
    color: #ffffff !important;
    background-color: #212529 !important;
}

[data-bs-theme="dark"] .card-body {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card-title {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .card-text {
    color: rgba(255, 255, 255, 0.8) !important;
}

[data-bs-theme="dark"] .table {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    color: #000000 !important;
    background-color: #ffffff !important;
}

[data-bs-theme="dark"] .form-label {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .badge {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .badge.bg-warning {
    color: #000000 !important;
}

/* Fix for main content areas and containers */
[data-bs-theme="dark"] .container,
[data-bs-theme="dark"] .container-fluid {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .row {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .col,
[data-bs-theme="dark"] .col-1,
[data-bs-theme="dark"] .col-2,
[data-bs-theme="dark"] .col-3,
[data-bs-theme="dark"] .col-4,
[data-bs-theme="dark"] .col-5,
[data-bs-theme="dark"] .col-6,
[data-bs-theme="dark"] .col-7,
[data-bs-theme="dark"] .col-8,
[data-bs-theme="dark"] .col-9,
[data-bs-theme="dark"] .col-10,
[data-bs-theme="dark"] .col-11,
[data-bs-theme="dark"] .col-12,
[data-bs-theme="dark"] .col-md-1,
[data-bs-theme="dark"] .col-md-2,
[data-bs-theme="dark"] .col-md-3,
[data-bs-theme="dark"] .col-md-4,
[data-bs-theme="dark"] .col-md-5,
[data-bs-theme="dark"] .col-md-6,
[data-bs-theme="dark"] .col-md-7,
[data-bs-theme="dark"] .col-md-8,
[data-bs-theme="dark"] .col-md-9,
[data-bs-theme="dark"] .col-md-10,
[data-bs-theme="dark"] .col-md-11,
[data-bs-theme="dark"] .col-md-12,
[data-bs-theme="dark"] .col-lg-1,
[data-bs-theme="dark"] .col-lg-2,
[data-bs-theme="dark"] .col-lg-3,
[data-bs-theme="dark"] .col-lg-4,
[data-bs-theme="dark"] .col-lg-5,
[data-bs-theme="dark"] .col-lg-6,
[data-bs-theme="dark"] .col-lg-7,
[data-bs-theme="dark"] .col-lg-8,
[data-bs-theme="dark"] .col-lg-9,
[data-bs-theme="dark"] .col-lg-10,
[data-bs-theme="dark"] .col-lg-11,
[data-bs-theme="dark"] .col-lg-12 {
    color: #ffffff !important;
}

/* Fix for all text elements */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
    color: #ffffff !important;
}

[data-bs-theme="dark"] p,
[data-bs-theme="dark"] span,
[data-bs-theme="dark"] div {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .text-center {
    color: #ffffff !important;
}

/* Fix for main page sections */
[data-bs-theme="dark"] main {
    background-color: #212529 !important;
    color: #ffffff !important;
}

/* Override any white/light backgrounds */
[data-bs-theme="dark"] .bg-light {
    background-color: #343a40 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #212529 !important;
    color: #ffffff !important;
}

/* Fix for specific sections that might have light backgrounds */
[data-bs-theme="dark"] section {
    background-color: transparent !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .jumbotron {
    background-color: #343a40 !important;
    color: #ffffff !important;
}

/* Global text color override for dark theme */
[data-bs-theme="dark"] * {
    color: #ffffff !important;
}

/* Exception for elements that should keep their specific colors */
[data-bs-theme="dark"] .btn-primary {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-success {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-danger {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-warning {
    color: #000000 !important;
}

[data-bs-theme="dark"] .btn-info {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .btn-secondary {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .text-primary {
    color: #0d6efd !important;
}

[data-bs-theme="dark"] .text-success {
    color: #198754 !important;
}

[data-bs-theme="dark"] .text-danger {
    color: #dc3545 !important;
}

[data-bs-theme="dark"] .text-warning {
    color: #ffc107 !important;
}

[data-bs-theme="dark"] .text-info {
    color: #0dcaf0 !important;
}

/* Fix for light buttons in dark theme */
[data-bs-theme="dark"] .btn-light {
    background-color: #f8f9fa !important;
    border-color: #f8f9fa !important;
    color: #212529 !important;
}

[data-bs-theme="dark"] .btn-light:hover {
    background-color: #e9ecef !important;
    border-color: #e9ecef !important;
    color: #212529 !important;
}

[data-bs-theme="dark"] .btn-outline-light {
    color: #f8f9fa !important;
    border-color: #f8f9fa !important;
    background-color: transparent !important;
}

[data-bs-theme="dark"] .btn-outline-light:hover {
    color: #212529 !important;
    background-color: #f8f9fa !important;
    border-color: #f8f9fa !important;
}

/* Fix card backgrounds to be dark */
[data-bs-theme="dark"] .card {
    background-color: #343a40 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Ensure sections maintain dark theme */
[data-bs-theme="dark"] .container .row .col-md-4 .card {
    background-color: #343a40 !important;
}

/* Church branding */
.church-brand {
    color: var(--church-primary);
}

.church-accent {
    color: var(--church-accent);
}

/* Image upload preview */
.image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 0.5rem;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    padding: 1rem;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
}

/* Business photo management */
.photo-item {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
}

.photo-item .photo-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.photo-item:hover .photo-actions {
    opacity: 1;
}

/* Search form styling */
.search-form {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

/* Business statistics */
.stat-card {
    text-align: center;
    padding: 2rem 1rem;
    border-radius: 0.75rem;
    transition: transform 0.2s ease-in-out;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

/* Error pages */
.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-code {
    font-size: 6rem;
    font-weight: 300;
    color: var(--bs-primary);
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Focus states for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
