/* ========================================
   ULTRA MODAL SYSTEM - SOBER & MINIMALIST
   ======================================== */

/* === MODAL OVERLAY === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* === MODAL CONTAINER === */
.modal-ultra {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid #f1f5f9;
}

.modal-overlay.show .modal-ultra {
    transform: scale(1) translateY(0);
}

/* === CLOSE BUTTON === */
.modal-close-float {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 10;
}

.modal-close-float:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.modal-close-float svg {
    width: 16px;
    height: 16px;
    color: #64748b;
}

/* === MODAL HEADER === */
.modal-header-ultra {
    padding: 24px 24px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
}

.modal-icon-ultra {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-icon-ultra svg {
    width: 20px;
    height: 20px;
    color: #64748b;
}

.modal-title-section {
    flex: 1;
}

.modal-title-ultra {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.modal-desc-ultra {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
}

/* === MODAL CONTENT === */
.modal-content-ultra {
    padding: 24px;
    max-height: calc(85vh - 160px);
    overflow-y: auto;
}

/* === FORM STYLES === */
.form-ultra {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group-ultra {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row-ultra {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-label-ultra {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin: 0;
}

.form-input-ultra,
.form-textarea-ultra {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background: #ffffff;
    transition: all 0.15s ease;
    font-family: inherit;
}

.form-input-ultra:focus,
.form-textarea-ultra:focus {
    outline: none;
    border-color: #cbd5e1;
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.1);
}

.form-input-ultra::placeholder,
.form-textarea-ultra::placeholder {
    color: #94a3b8;
}

.form-textarea-ultra {
    resize: vertical;
    min-height: 80px;
    line-height: 1.4;
}

.form-help-ultra {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

/* === IMAGE UPLOAD === */
.image-upload-ultra {
    position: relative;
}

.image-input-ultra {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.image-preview-ultra {
    width: 100%;
    height: 160px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    background: #f8fafc;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.image-preview-ultra:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-placeholder-ultra {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    text-align: center;
}

.image-placeholder-ultra svg {
    width: 32px;
    height: 32px;
    color: #cbd5e1;
}

.image-placeholder-ultra span {
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
}

.image-preview-ultra img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* === SWITCH STYLE === */
.form-switch-ultra {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 0;
}

.form-switch-ultra input[type="checkbox"] {
    display: none;
}

.form-switch-slider {
    width: 40px;
    height: 22px;
    background: #e2e8f0;
    border-radius: 11px;
    position: relative;
    transition: all 0.2s ease;
}

.form-switch-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.form-switch-ultra input[type="checkbox"]:checked + .form-switch-slider {
    background: #cbd5e1;
}

.form-switch-ultra input[type="checkbox"]:checked + .form-switch-slider::before {
    transform: translateX(18px);
}

.form-switch-label {
    font-size: 13px;
    font-weight: 400;
    color: #475569;
}

/* === MODAL FOOTER === */
.modal-footer-ultra {
    padding: 20px 24px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #ffffff;
}

/* === BUTTONS === */
.btn-ultra {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary-ultra {
    background: #f8fafc;
    color: #475569;
    border-color: #e2e8f0;
}

.btn-primary-ultra:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-primary-ultra:active {
    background: #e2e8f0;
}

.btn-secondary-ultra {
    background: #ffffff;
    color: #64748b;
    border-color: #e2e8f0;
}

.btn-secondary-ultra:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-ultra svg {
    width: 14px;
    height: 14px;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .modal-ultra {
        width: 95%;
        margin: 16px;
        border-radius: 12px;
    }
    
    .modal-header-ultra {
        padding: 20px 20px 16px;
    }
    
    .modal-content-ultra {
        padding: 20px;
    }
    
    .modal-footer-ultra {
        padding: 16px 20px 20px;
        flex-direction: column;
    }
    
    .form-row-ultra {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .modal-title-ultra {
        font-size: 16px;
    }
    
    .modal-icon-ultra {
        width: 36px;
        height: 36px;
    }
    
    .modal-icon-ultra svg {
        width: 18px;
        height: 18px;
    }
}

/* === SCROLLBAR STYLING === */
.modal-content-ultra::-webkit-scrollbar {
    width: 4px;
}

.modal-content-ultra::-webkit-scrollbar-track {
    background: #f8fafc;
}

.modal-content-ultra::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.modal-content-ultra::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* === FOCUS STATES === */
.btn-ultra:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
}

.form-input-ultra:focus,
.form-textarea-ultra:focus {
    outline: none;
    border-color: #cbd5e1;
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.1);
}

/* === LOADING STATES === */
.btn-ultra.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-ultra.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 1px solid transparent;
    border-top: 1px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   ENHANCED MODAL STYLES - ULTRA MODERN
   ======================================== */

/* === MODAL ANIMATIONS === */
@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-overlay.show .modal {
    animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* === STANDARD MODAL CONTAINER === */
.modal {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
    max-width: 600px;
    width: 92%;
    max-height: 88vh;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.modal-large {
    max-width: 900px;
}

/* === MODAL HEADER === */
.modal-header {
    padding: 28px 32px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.4px;
}

/* === MODAL CLOSE BUTTON === */
.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    font-size: 18px;
}

.modal-close:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: rotate(90deg);
}

/* === MODAL BODY === */
.modal-body {
    padding: 32px;
    max-height: calc(88vh - 180px);
    overflow-y: auto;
    scroll-behavior: smooth;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* === FORM GROUPS === */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #1e293b;
    background: #ffffff;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* === MODAL FOOTER === */
.modal-footer {
    padding: 24px 32px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fafbfc;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* === ENHANCED BUTTONS === */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.btn-primary {
    background: linear-gradient(135deg, #8c9a7d 0%, #6b7c5a 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(140, 154, 125, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(140, 154, 125, 0.3);
}

.btn-primary:active {
    transform: translateY(0px);
}

.btn-secondary {
    background: #ffffff;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* === TABLE STYLES IN MODALS === */
.modal-body table {
    width: 100%;
    border-collapse: collapse;
}

.modal-body table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.modal-body table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #64748b;
    font-size: 0.9rem;
}

.modal-body table tr:hover {
    background: #f8fafc;
}

/* === BADGES & LABELS === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge.success {
    background: rgba(140, 154, 125, 0.1);
    color: #6b7c5a;
}

.badge.warning {
    background: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
}

.badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* === CHECKBOX & RADIO === */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.checkbox-label:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"]:checked,
.checkbox-label input[type="radio"]:checked {
    accent-color: #8c9a7d;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        max-height: 92vh;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 20px 24px;
    }
    
    .modal-header h2,
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 24px;
    }
    
    .modal-footer {
        padding: 20px 24px;
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}
