/* Base styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    font-family: system-ui, -apple-system, sans-serif;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Editor styles */
.ql-editor {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.75rem;
}

.ql-editor:focus {
    outline: 2px solid #5D5CDE;
    outline-offset: 2px;
}

.dark .ql-editor {
    background-color: #1e1e1e;
    color: #e2e8f0;
    border-color: #4a5568;
}

.editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Card styles */
.sermon-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.sermon-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark .sermon-card {
    background-color: #2d3748;
    border-color: #4a5568;
}

.dark .sermon-card h3 {
    color: #e2e8f0;
}

/* View containers */
.view-container {
    width: 100%;
    padding-bottom: 2rem;
}

/* Loader styles */
.loader {
    border: 3px solid rgba(93, 92, 222, 0.3);
    border-radius: 50%;
    border-top: 3px solid #5D5CDE;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

/* Fade transition */
.fade-enter-active, .fade-leave-active {
    transition: opacity 0.3s;
}
.fade-enter, .fade-leave-to {
    opacity: 0;
}

/* Authentication containers */
#auth-container, 
#storage-setup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
    background-color: #f9fafb;
}

.dark #auth-container,
.dark #storage-setup-container {
    background-color: #111827;
}

/* Main application structure */
#main-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

header {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
}

/* Updated header layout to ensure logo is left-justified */
header .max-w-7xl {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

header .flex-shrink-0 {
    margin-right: auto; /* This ensures the logo stays left */
}

main {
    flex: 1;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding-bottom: 2rem;
}

footer {
    width: 100%;
}

/* Menu and navigation */
#mobile-menu {
    z-index: 45;
    border-top: 1px solid #e5e7eb;
    transition: max-height 0.3s ease;
    overflow: hidden;
    display: none; /* Hide mobile menu by default */
}

.dark #mobile-menu {
    border-top-color: #4b5563;
}

/* Navigation styles */
.nav-link, .mobile-nav-link {
    cursor: pointer;
    transition: color 0.2s;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    margin-right: 1.5rem !important;
}

.nav-link:last-child {
    margin-right: 0 !important;
}

.nav-link.active, .mobile-nav-link.active {
    color: #5D5CDE !important;
    font-weight: 600;
}

/* Make sure the header elements are properly visible */
header .flex-shrink-0, 
header .flex-1, 
header nav,
header button {
    display: flex !important;
}

/* Ensure nav items are properly displayed */
header nav {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    gap: 1.5rem;
}

/* Updated mobile and desktop navigation styles */
@media (max-width: 767px) {
    /* Mobile styles */
    header nav.hidden {
        display: none !important;
    }
    
    #mobile-menu.hidden {
        display: none !important;
    }
    
    #mobile-menu:not(.hidden) {
        display: block !important;
    }
    
    header nav {
        display: none !important; /* Hide desktop nav on mobile */
    }
}

@media (min-width: 768px) {
    /* Desktop styles */
    header nav {
        display: flex !important; /* Always show desktop nav */
    }
    
    #mobile-menu {
        display: none !important; /* Always hide mobile menu */
    }
    
    #mobile-menu-button {
        display: none !important; /* Hide mobile menu button */
    }
}

/* User dropdown menu styling - improved for proper display */
#user-dropdown {
    top: 100%;
    right: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 45;
    width: 200px;
    background: white;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dark #user-dropdown {
    background-color: #2d3748;
}

#user-dropdown.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

#user-dropdown:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    display: block !important;
}

/* Ensure all dropdown items are visible when shown */
#user-dropdown button {
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
    display: block !important;
}

#user-dropdown button:hover {
    background-color: #f3f4f6;
}

.dark #user-dropdown button:hover {
    background-color: #374151;
}

/* Mobile menu toggle button */
#mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Dropdown menus */
#user-dropdown {
    z-index: 45;
}

/* Overlay elements */
#loading-overlay {
    z-index: 9999;
}

/* Toast notification */
#toast-notification {
    z-index: 9999;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Make sure hidden elements are completely hidden */
.hidden {
    display: none !important;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .sermon-grid {
        grid-template-columns: 1fr;
    }
    
    header {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    main {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Fix for search inputs */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

/* Settings tabs */
.setting-tab {
    transition: color 0.2s, border-color 0.2s;
}

/* Form elements in dark mode */
.dark input,
.dark textarea,
.dark select {
    color-scheme: dark;
}

/* Prose styling for preview content */
.prose {
    max-width: 65ch;
    color: #374151;
    line-height: 1.75;
}

.dark .prose {
    color: #e5e7eb;
}

.prose h1, .prose h2, .prose h3 {
    color: #111827;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.dark .prose h1, .dark .prose h2, .dark .prose h3 {
    color: #f9fafb;
}

.prose p {
    margin-top: 1em;
    margin-bottom: 1em;
}

.prose ul, .prose ol {
    margin-top: 1em;
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.prose blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1em;
    font-style: italic;
    margin: 1em 0;
}

.dark .prose blockquote {
    border-left-color: #4b5563;
}

.prose .scripture {
    font-style: italic;
    color: #4b5563;
}

.dark .prose .scripture {
    color: #9ca3af;
}

/* Dashboard components */
#dashboard-view .bg-white,
#sermons-view .bg-white,
#series-view .bg-white,
#settings-view .bg-white {
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Fix for hidden navigation elements in main app */
#main-app:not(.hidden) header,
#main-app:not(.hidden) nav,
#main-app:not(.hidden) .nav-link,
#main-app:not(.hidden) .mobile-nav-link {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Fix for button visibility */
button:not([disabled]),
a:not([disabled]) {
    pointer-events: auto !important;
}

/* Ensure dropdowns are properly positioned */
.relative {
    position: relative !important;
}

.fixed, .absolute {
    position: fixed !important;
    visibility: visible !important;
}

/* Fix for toggle buttons */
#mobile-menu-button, #user-menu-button {
    cursor: pointer;
    display: flex !important;
}

/* Fix for editor toolbar buttons */
.editor-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}