/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 2rem;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Container */
.modal-container {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 60vw;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

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

/* Modal Header */
.modal-header {
    padding: 2rem 2.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.modal-title i {
    color: var(--primary);
    font-size: 1.5rem;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gray-100);
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
    transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
    padding: 2.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Custom Scrollbar */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Modal Footer */
.modal-footer {
    padding: 1.5rem 2.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    background: var(--gray-50);
    border-radius: 0 0 16px 16px;
}

/* Form Section */
.form-section {
    margin-bottom: 2.5rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
}

.form-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.625rem;
    font-size: 0.875rem;
}

.form-label i {
    color: var(--gray-400);
    font-size: 0.875rem;
}

.form-label .required {
    color: var(--danger);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9375rem;
    transition: var(--transition);
    background: var(--white);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: var(--white);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
    background: var(--gray-50);
    color: var(--gray-500);
    cursor: not-allowed;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    padding: 0.875rem 1.75rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    justify-content: center;
    white-space: nowrap;
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Detail View */
.detail-grid {
    display: grid;
    gap: 1.75rem;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
}

.detail-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.detail-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.detail-section-content {
    display: grid;
    gap: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 10px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.detail-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition);
    border-radius: 10px 10px 0 0;
}

/* Hover state */
.detail-item:hover {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* Show gradient line on hover */
.detail-item:hover::before {
    transform: scaleX(1);
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-label i {
    font-size: 0.875rem;
}

.detail-value {
    font-size: 1rem;
    color: var(--gray-900);
    font-weight: 500;
    line-height: 1.5;
}

.detail-value.empty {
    color: var(--gray-400);
    font-style: italic;
}

.detail-value a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: var(--transition);
}

.detail-value a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.detail-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    display: inline-block;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.detail-tag {
    padding: 0.375rem 0.875rem;
    background: var(--primary);
    color: var(--white);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.detail-tag i {
    font-size: 0.75rem;
}

/* Delete Confirmation */
.delete-confirmation {
    text-align: center;
    padding: 2rem 1rem;
}

.delete-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

.delete-icon i {
    font-size: 2.5rem;
    color: var(--danger);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.delete-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.75rem;
}

.delete-message {
    font-size: 1.125rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.delete-project-name {
    font-weight: 700;
    font-size: 1.375rem;
    color: var(--danger);
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 10px;
    border: 2px dashed var(--danger);
}

.delete-warning {
    color: var(--gray-500);
    margin-top: 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem;
    }

    .modal-container {
        max-height: 95vh;
    }

    .modal-header {
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }

    .modal-footer>div {
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .detail-section-content {
        gap: 1rem;
    }
}

/* Choices.js Integration */
.modal-body .choices {
    margin-bottom: 0;
}

.modal-body .choices__inner {
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    padding: 0.75rem;
    min-height: 48px;
    background: var(--white);
}

.modal-body .choices__inner:focus,
.modal-body .choices.is-focused .choices__inner {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.modal-body .choices__list--multiple .choices__item {
    background: var(--primary);
    border: none;
    border-radius: 6px;
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
}

/* Loading State */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Two Column Layout for Specific Sections */
.detail-section-content.two-columns {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

@media (max-width: 640px) {
    .detail-section-content.two-columns {
        grid-template-columns: 1fr;
    }
}

/* Country Flag Styles */
.country-flag-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    transition: var(--transition);
}

.country-flag-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.country-flag-img {
    width: 28px;
    height: 20px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.country-code {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9375rem;
}

/* Country Tags Container */
.country-flags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .country-flags-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}