/* ========================================
   GreenStep Hub - Modals Styles
   ======================================== */

/* Container for modals - must not block clicks when empty */
#modalsContainer:empty,
#toastContainer:empty {
    pointer-events: none;
}

/* Hidden modal overlay should not block clicks */
.modal-overlay[style*="display: none"],
.modal-overlay[style*="display:none"] {
    pointer-events: none !important;
    visibility: hidden !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
    pointer-events: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    background: var(--card);
    border-radius: 20px;
    padding: 0;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    pointer-events: auto;
}

/* Ensure ALL buttons inside modals are clickable */
.modal button,
.modal-overlay button,
.modal input,
.modal textarea,
.modal select,
.modal a {
    pointer-events: auto !important;
    cursor: pointer;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2,
.modal-header h3,
.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.modal-content {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-content .form-group {
    margin-bottom: 1rem;
}

.modal-content .form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 0.4rem;
}

.modal-content .form-group input,
.modal-content .form-group select,
.modal-content .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    transition: all 0.2s;
}

.modal-content .form-group input:focus,
.modal-content .form-group select:focus,
.modal-content .form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: white;
}

.modal-content .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    background: var(--card);
    position: relative;
    z-index: 10;
}

.modal-content .form-actions .btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.modal-content .form-actions .btn {
    min-width: 100px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Ensure modal buttons are always visible */
.modal-content .form-actions .btn.btn-secondary,
.modal .form-actions .btn.btn-secondary {
    background: #e2e8f0 !important;
    color: #1e293b !important;
    border: 2px solid #94a3b8 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.modal-content .form-actions .btn.btn-primary,
.modal .form-actions .btn.btn-primary {
    background: linear-gradient(135deg, #006838, #8DC63F) !important;
    color: white !important;
    border: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text3);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg2);
    color: var(--text);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    background: var(--card);
    flex-shrink: 0;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.modal-footer .btn {
    min-width: 100px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Drop Zone for File Upload */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg2);
    margin-bottom: 1.5rem;
}

.drop-zone:hover {
    border-color: var(--blue);
    background: rgba(59, 130, 246, 0.05);
}

.drop-zone.drag-over {
    border-color: var(--green);
    background: rgba(16, 185, 129, 0.1);
}

.drop-zone.has-file {
    border-color: var(--green);
    background: rgba(16, 185, 129, 0.05);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.drop-zone-icon {
    font-size: 3rem;
}

.drop-zone-text {
    font-weight: 600;
    color: var(--text);
}

.drop-zone-hint {
    font-size: 0.85rem;
    color: var(--text3);
}

.drop-zone-file {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.drop-zone-file-icon {
    font-size: 2rem;
}

.drop-zone-file-name {
    font-weight: 600;
    color: var(--text);
}

.drop-zone-file-size {
    font-size: 0.85rem;
    color: var(--text3);
}

/* Confirm Dialog */
.confirm-dialog {
    max-width: 400px;
    text-align: center;
}

.confirm-dialog .modal-body {
    padding: 2rem;
}

.confirm-dialog p {
    font-size: 1.1rem;
    color: var(--text2);
    margin-bottom: 1.5rem;
}

.confirm-dialog .modal-footer {
    justify-content: center;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg2);
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green));
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* Modal Sections */
.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 768px) {
    .modal {
        max-width: 100%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem 1.5rem;
    }
}
