/* ================================================================ */
/* MODAL SYSTEM - FROSTED GLASS (LIGHT THEME) */
/* ================================================================ */

/* Base modal styling - all modals inherit this */
.modal-content {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
    overflow: hidden;
}

/* Modal Backdrop - Solid overlay (not transparent) */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.modal-header {
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title i {
    color: #2b6fd6;
    font-size: 1rem;
}

.btn-close {
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 1.5rem;
    max-height: 65vh;
    overflow-y: auto;
    background: #ffffff;
}

/* Custom scrollbar for modals */
.modal-body::-webkit-scrollbar {
    width: 5px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.15);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.25);
}

.modal-footer {
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1rem 1.5rem;
    gap: 0.75rem;
}

/* Default modal button styles */
.modal-content .btn-secondary {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.15);
    color: #475569;
    border-radius: 10px;
    padding: 0.6rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.modal-content .btn-secondary:hover {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, 0.25);
    color: #0f172a;
}

.modal-content .btn-primary {
    background: linear-gradient(180deg, #4ea8ff 0%, #2b6fd6 100%);
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(43, 111, 214, 0.2);
    transition: all 0.15s ease;
}

.modal-content .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(43, 111, 214, 0.3);
}

.modal-content .btn-primary:disabled {
    opacity: 0.5;
    box-shadow: none;
}

/* Form controls in modals */
.modal-content .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.35rem;
}

.modal-content .form-control,
.modal-content .form-select {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    border-radius: 10px !important;
    color: #0f172a !important;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.modal-content .form-control:focus,
.modal-content .form-select:focus {
    background: #ffffff !important;
    border-color: #2b6fd6 !important;
    box-shadow: 0 0 0 3px rgba(43, 111, 214, 0.1) !important;
    outline: none;
}

.modal-content .form-control::placeholder {
    color: #94a3b8;
}

/* Select dropdown arrow */
.modal-content .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 14px 10px !important;
    padding-right: 2.25rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Checkboxes in modals */
.modal-content .form-check {
    padding-left: 1.75rem;
    margin-bottom: 0;
    min-height: auto;
    display: block;
}

.modal-content .form-check-input {
    width: 1rem;
    height: 1rem;
    margin-left: -1.75rem;
    margin-top: 0.2rem;
    background-color: #ffffff;
    border: 1.5px solid rgba(15, 23, 42, 0.25);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    float: left;
}

.modal-content .form-check-input:checked {
    background-color: #2b6fd6;
    border-color: #2b6fd6;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.modal-content .form-check-input:focus {
    box-shadow: 0 0 0 2px rgba(43, 111, 214, 0.15);
    border-color: #2b6fd6;
}

.modal-content .form-check-label {
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    line-height: 1.4;
}

/* Modal animations */
.modal.fade .modal-dialog {
    animation: modalSlideIn 0.3s ease-out forwards;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ================================================================ */
/* MODAL VARIANTS */
/* ================================================================ */

/* Success modal (green accent) */
.modal-content.modal-success .modal-title i {
    color: #16a34a;
}

.modal-content.modal-success .btn-primary {
    background: linear-gradient(180deg, #34d399 0%, #16a34a 100%);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.modal-content.modal-success .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.3);
}

/* Danger modal (red accent) */
.modal-content.modal-danger .modal-title i {
    color: #dc2626;
}

.modal-content.modal-danger .btn-primary {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}

.modal-content.modal-danger .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.3);
}

/* Warning modal (amber accent) */
.modal-content.modal-warning .modal-title i {
    color: #f59e0b;
}

.modal-content.modal-warning .btn-primary {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.modal-content.modal-warning .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

/* Info modal (cyan accent) */
.modal-content.modal-info .modal-title i {
    color: #06b6d4;
}

.modal-content.modal-info .btn-primary {
    background: linear-gradient(180deg, #22d3ee 0%, #06b6d4 100%);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

.modal-content.modal-info .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.3);
}

/* ================================================================ */
/* MODAL SIZE VARIANTS */
/* ================================================================ */

/* Small modal (for confirmations, simple forms) */
.modal-sm .modal-content {
    border-radius: 16px;
}

/* Large modal (for complex forms, data tables) */
.modal-lg .modal-dialog {
    max-width: 900px;
}

/* ================================================================ */
/* RESPONSIVE MODALS */
/* ================================================================ */

@media (max-width: 768px) {
    .modal-header {
        padding: 1rem 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
    }

    .modal-title {
        font-size: 1rem;
    }

    .modal-content .btn-primary,
    .modal-content .btn-secondary {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .modal-body .form-control,
    .modal-body .form-select {
        font-size: 16px !important; /* Prevents iOS zoom on input */
    }
}

@media (max-width: 480px) {
    .modal-dialog {
        margin: 1rem 0.5rem;
    }

    .modal-content {
        border-radius: 16px;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-title {
        font-size: 0.95rem;
        gap: 0.3rem;
    }

    .modal-title i {
        font-size: 0.9rem;
    }

    .modal-body {
        padding: 1rem;
        max-height: 70vh;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ================================================================ */
/* UTILITY CLASSES FOR MODAL CUSTOMIZATION */
/* ================================================================ */

/* Center content in modal body */
.modal-centered-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Stacked form layout */
.modal-form-stacked {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Modal with divider */
.modal-divider {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    margin: 1rem 0;
    padding-top: 1rem;
}

/* Modal success/error message */
.modal-message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: none;
}

.modal-message.show {
    display: block;
}

.modal-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #0f5132;
}

.modal-message.error {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #7f1d1d;
}

.modal-message.warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #78350f;
}

.modal-message.info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

/* ================================================================ */
/* CUSTOM CENTERED MODAL OVERLAY (für Admin-Modals) */
/* ================================================================ */

.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.admin-modal-overlay[style*="display: flex"],
.admin-modal-overlay.admin-modal-overlay {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.admin-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out forwards;
}

.admin-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: transparent;
}

.admin-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.admin-modal-title i {
    color: #2b6fd6;
    font-size: 1.2rem;
}

.admin-modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.admin-modal-close:hover {
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
}

.admin-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: transparent;
}

.admin-modal-body::-webkit-scrollbar {
    width: 6px;
}

.admin-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.admin-modal-body::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.15);
    border-radius: 3px;
}

.admin-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.25);
}

.admin-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: transparent;
}

/* Responsive for mobile */
@media (max-width: 768px) {
    .admin-modal {
        max-width: calc(100% - 1rem);
        max-height: calc(100vh - 2rem);
    }

    .admin-modal-header {
        padding: 1.25rem;
    }

    .admin-modal-body {
        padding: 1.25rem;
    }

    .admin-modal-footer {
        padding: 1rem;
        flex-direction: column;
    }

    .admin-modal-footer .admin-btn {
        width: 100%;
    }
}

/* ================================================================ */
