/* Modern Modal System - Flexbox Only */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
}

.modal-header p {
    margin: 8px 0 0 0;
    color: #64748b;
    font-size: 14px;
    text-align: center;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    color: #64748b;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.modal-content {
    position: relative;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #ef4444;
    transform: scale(1.1);
}

/* Form Styles */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.form-group label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: 'Tajawal', sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: #374151;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* Mobile Responsive (< 992px) */
@media (max-width: 992px) {
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: 95vh;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .modal-close {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        margin: 5px;
    }

    .modal-header {
        padding: 12px;
    }

    .modal-header h2 {
        font-size: 16px;
    }

    .modal-body {
        padding: 12px;
    }

    .modal-footer {
        padding: 12px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px 12px;
        font-size: 13px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Specific Modal Types */
.modal-order .modal-body {
    max-height: 60vh;
}

.modal-user .modal-body {
    max-height: 70vh;
}

.modal-confirm .modal-body {
    text-align: center;
    padding: 30px 20px;
}

.modal-alert .modal-body {
    text-align: center;
    padding: 30px 20px;
}

/* Icon Styles */
.modal-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 24px;
}

.modal-icon.success {
    background: #10b981;
    color: white;
}

.modal-icon.danger {
    background: #ef4444;
    color: white;
}

.modal-icon.info {
    background: #3b82f6;
    color: white;
}

.modal-icon.warning {
    background: #f59e0b;
    color: white;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.w-full {
    width: 100%;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}