/* General styles */
body {
    padding-bottom: 2rem;
    background-color: #f4f6f9;
}

/* Section visibility */
.app-section {
    display: none;
}

.app-section.active {
    display: block;
}

/* Login Overlay */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f4f6f9;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

/* Loading overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 2001;
    display: none;
}

/* Refresh Overlay (Blocks interaction) */
#refreshOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#refreshOverlay .alert {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 400px;
    text-align: center;
}

.layout-container {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
    padding: 0;
    margin: 0;
    width: 100%;
    justify-content: flex-start;
}

.planlist-items-container {
    width: 80%;
    margin: 0 !important;
    margin-left: 20px !important;
}

.table th:nth-child(3) {
    width: 28%;
}

.table th:nth-child(4) {
    width: 20%;
}

/* Service Items Table and Info Container Styles */
/* Service Items Table and Info Container Styles */
.service-items-container {
    flex: 2 1 60%;
    min-width: 600px;
    padding: 0;
    margin-left: 20px !important;
    margin: 0;
}

.service-info-container {
    flex: 1 1 30%;
    min-width: 300px;
    padding: 20px;
    border: 2px solid #fd7e14;
    border-radius: 4px;
    align-self: flex-start;
}

@media (max-width: 1025px) {

    .service-items-container,
    .service-info-container {
        flex: 1 1 100%;
    }

    .service-info-container {
        margin-bottom: 2rem;
        max-width: 100%;
        width: 100%;
        margin-left: 0px !important;
        margin-right: 38px !important;
    }

    .service-info-container #serviceNotes {
        min-height: 75px !important;
    }

    .service-info-container #additionalEmails {
        height: 75px !important;
    }
}

.table-responsive {
    margin: 0;
    border: 2px solid #fd7e14;
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.table td,
.table th {
    border-right: 2px solid #dee2e6;
}

.table td:last-child,
.table th:last-child {
    border-right: none;
}

/* Hide slides column - scoped to service items table only */
#serviceItemsTable th:nth-child(6),
#serviceItemsTable td:nth-child(6) {
    display: none;
}

.table td.item-type {
    font-weight: normal;
    padding: 0.3rem;
    line-height: 1.2;
    min-width: 100px;
}

.table td.item-detail {
    font-weight: normal;
    padding: 0.3rem;
    line-height: 1.2;
    min-width: 500px;
    text-align: left;
}

.table th {
    padding: 0.4rem;
    line-height: 1.2;
}

.table .btn-sm {
    padding: 0.1rem 0.3rem;
    font-size: 0.75rem;
    line-height: 1;
    height: 20px;
}

/* Action button styles */
.table .btn-sm.edit-btn,
.table .btn-sm.upload-btn {
    font-size: 1.0rem;
    padding: 0.3rem 0.6rem;
    height: auto;
    background-color: #f8f9fa;
    border: 1px solid #fd7e14;
    transition: all 0.2s ease;
}

.table .btn-sm.edit-btn:hover,
.table .btn-sm.upload-btn:hover {
    background-color: #fd7e14;
    color: white;
    transform: scale(1.1);
}

.table .btn-sm.edit-btn span,
.table .btn-sm.upload-btn span {
    color: #fd7e14;
    font-weight: normal;
}

.table .btn-sm.edit-btn:hover span,
.table .btn-sm.upload-btn:hover span {
    color: white;
}

.table td {
    padding: 0.3rem;
    vertical-align: middle;
}

/* Center the checkboxes in their cells */
.table td:nth-last-child(5),
.table td:nth-last-child(6) {
    text-align: center;
    vertical-align: middle;
}

/* Always hide slides and tUrls columns - scoped to service items table only */
#serviceItemsTable th:nth-child(6),
#serviceItemsTable td:nth-child(6),
#serviceItemsTable th:nth-child(7),
#serviceItemsTable td:nth-child(7) {
    display: none;
}

.item-type.song-link {
    color: #000;
    text-decoration: underline;
    cursor: pointer;
}

.item-type.song-link:hover {
    color: #0a58ca;
}

/* Context menu styles */
#itemTypeMenu,
#songReportContextMenu {
    position: fixed;
    z-index: 1060;
    display: none;
    font-size: 11pt;
    padding: 4px 0;
    background-color: white;
    border: 2px solid rgba(0, 0, 0, .15);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .15);
    max-height: 300px;
    overflow-y: auto;
    font-weight: bold !important;
}

#itemTypeMenu .dropdown-item,
#songReportContextMenu .dropdown-item {
    padding: 4px 16px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: bold !important;
}

#itemTypeMenu .dropdown-item:hover,
#songReportContextMenu .dropdown-item:hover {
    background-color: #f8f9fa;
    color: blue;
}

.item-type {
    cursor: context-menu;
}

.item-type.active {
    background-color: #e9ecef;
}

/* Service item drag and drop styles */
.drag-over {
    border-top: 2px solid #2c3e50;
}

tr.dragging,
tr.dragging-touch {
    opacity: 0.5;
    background-color: #f8f9fa;
    border: 2px dashed #fd7e14;
}

/* [draggable="true"] {
     cursor: grab !important; - Removed to restrict to handle 
} */

/* [draggable="true"]:active {
     cursor: grabbing !important; 
} */

tr.dragging {
    cursor: grabbing !important;
}

.item-number {
    cursor: grab;
    /* Show grab hand on handle */
    user-select: none;
}

.item-number:active {
    cursor: grabbing;
}

/* Slides Gallery styles */
.slides-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
    clear: both;
}

.slide-thumbnail {
    position: relative;
    border: 2px solid #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
    background-color: #f5f5f5;
}

.slide-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: white;
}

.slide-thumbnail .slide-number {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: white;
    color: black;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 10;
}

.slide-thumbnail .slide-source {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 10;
}

.slide-thumbnail.is-song {
    border-color: #0d6efd;
}

.slide-thumbnail.is-image {
    border-color: #198754;
}

/* Gallery zoom levels */
.slides-gallery[data-zoom="1"] {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.slides-gallery[data-zoom="2"] {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.slides-gallery[data-zoom="3"] {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Plan list styles */
.plan-list-container {
    max-width: 600px;
    margin: 0 auto;
}

.table tbody tr.plan-row {
    cursor: pointer;
}

.table tbody tr.plan-row:hover:not(.selected) {
    background-color: #e9ecef !important;
}

.table tbody tr.plan-row.selected,
.table tbody tr.plan-row.selected:hover {
    background-color: #fd7e14 !important;
}

.table tbody tr.plan-row.selected td,
.table tbody tr.plan-row.selected:hover td {
    color: white !important;
    background-color: blue !important;
}

.item-tUrls {
    font-family: monospace;
    font-size: 0.8em;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none;
}

/* Add to your existing CSS */
.blank-slide-icon {
    font-family: monospace;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -1px;
    color: #666;
    font-weight: normal;
}

.table th:hover .blank-slide-icon {
    color: #333;
}

/* Style the checkboxes */
.slide-before-checkbox,
.slide-after-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    display: block;
    margin: 0 auto;
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
}

#toast {
    visibility: hidden;
    min-width: 300px;
    background-color: #fff;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: left;
    border-radius: 8px;
    border-left: 5px solid #fd7e14;
    padding: 16px 20px;
    position: fixed;
    z-index: 2000;
    right: 30px;
    bottom: 30px;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
}

#toast.show {
    visibility: visible;
    transform: translateY(0);
    opacity: 1;
}

#toast.success {
    border-left-color: #198754;
}

#toast.error {
    border-left-color: #dc3545;
}

#toast.info {
    border-left-color: #0dcaf0;
}

#toast-icon {
    font-size: 24px;
}

/* Mobile and tablet styles */
.mobile-device .service-items-container {
    flex: 1 1 100%;
    min-width: 100%;
    margin: 0;
    padding: 0;
}

.mobile-device .table {
    font-size: 14px;
}

.mobile-device .table td,
.mobile-device .table th {
    padding: 8px 4px;
}

.mobile-device .table td.item-type {
    min-width: 80px;
    max-width: 100px;
}

.mobile-device .table td.item-detail {
    min-width: 300px;
}

/* Only hide action buttons on phone-sized screens */
@media (max-width: 768px) {

    .mobile-device .table th:nth-child(n+8),
    .mobile-device .table td:nth-child(n+8) {
        display: none;
    }
}

/* Show action buttons on iPad and larger tablets */
@media (min-width: 769px) {
    .mobile-device .service-items-container {
        min-width: 800px;
    }
}

/* Search and interface elements */
.search-type-group {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
}

.search-type-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.search-type-group input[type="radio"] {
    margin-right: 0.5rem;
}

#serviceNotes[contenteditable=true] {
    overflow-y: auto;
    white-space: pre-wrap;
    padding: 10px;
}

.btn-toolbar .btn[data-format] {
    min-width: 30px;
    font-weight: bold;
}

.btn-toolbar .btn[data-format="italic"] {
    font-style: italic;
}

.btn-toolbar .btn[data-format="underline"] {
    text-decoration: underline;
}

.btn-toolbar .btn[data-format].active {
    background-color: #fd7e14;
    color: white;
    border-color: #fd7e14;
}

/* New styles for Add New Song functionality */
#newSongModal .modal-content {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#newSongModal .modal-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #fd7e14;
}

#newSongModal .alert {
    margin-bottom: 0;
    margin-top: 1rem;
}

#newSongStatus {
    transition: all 0.3s ease;
}

.preview-btn {
    cursor: pointer;
    font-size: 24px;
    color: #888;
    transition: all 0.2s ease;
    user-select: none;
}

.preview-btn:hover {
    transform: scale(1.2);
    color: #fd7e14;
}

/* --- How To Guide Styles --- */
.search-highlight {
    background-color: #ffeb3b;
    padding: 2px;
    border-radius: 2px;
    transition: background-color 0.2s;
}

.search-highlight:hover {
    background-color: #fdd835;
}

#howToSearch {
    border: 2px solid #fd7e14;
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.3s ease;
}

#howToSearch:focus {
    border-color: #fd7e14;
    box-shadow: 0 0 0 0.2rem rgba(253, 126, 20, 0.25);
}

.accordion-button:not(.collapsed) {
    background-color: #fff3e0;
    color: #fd7e14;
}

.accordion-button:focus {
    border-color: #fd7e14;
    box-shadow: 0 0 0 0.2rem rgba(253, 126, 20, 0.25);
}

#noResults {
    padding: 15px;
    margin-top: 10px;
    border-radius: 8px;
    background-color: #e6f3ff;
    border: 2px solid #fd7e14;
    color: #000;
    font-weight: bold;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-container {
    position: relative;
    margin-bottom: 1rem;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #fd7e14;
    pointer-events: none;
}

.clear-search {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #6c757d;
}

.clear-search:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #000;
}