/* Consultation Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    animation: modalFadeIn 0.4s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    margin: 2% auto;
    padding: 0;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.5s ease-out;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/images/business-consultations.jpg') center/cover;
    opacity: 0.1;
    z-index: -1;
    border-radius: 20px;
}

.modal-header {
    background: linear-gradient(135deg, #6a148b, #8b1a9c);
    padding: 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/images/business-consultations.jpg') center/cover;
    opacity: 0.2;
    z-index: 0;
}

.modal-header > * {
    position: relative;
    z-index: 1;
}

.modal-logo {
    width: 80px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.modal-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.modal-body {
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.95);
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(95vh - 140px); /* Subtract header height */
    scroll-behavior: smooth;
    position: relative;
}

/* Scroll indicator for long content */
.modal-body::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.9), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-body.has-scroll::after {
    opacity: 1;
}

/* Scroll hint at the bottom */
.modal-body.has-scroll::before {
    content: '스크롤하여 더 많은 내용을 확인하세요 ↓';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(106, 20, 139, 0.9);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 10;
    animation: scrollHint 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes scrollHint {
    0%, 100% { 
        opacity: 0.7;
        transform: translateX(-50%) translateY(0);
    }
    50% { 
        opacity: 1;
        transform: translateX(-50%) translateY(-3px);
    }
}

/* Hide scroll hint when user starts scrolling */
.modal-body.scrolled::before {
    display: none;
}

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

.modal-body::-webkit-scrollbar-track {
    background: rgba(241, 241, 241, 0.3);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #6a148b, #8b1a9c);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7d1a9f, #9e20b3);
}

/* Firefox scrollbar styling */
.modal-body {
    scrollbar-width: thin;
    scrollbar-color: #6a148b rgba(241, 241, 241, 0.3);
}

.consultation-form {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.consultation-form label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.3px;
}

.consultation-form input,
.consultation-form textarea,
.consultation-form select {
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.consultation-form input:focus,
.consultation-form textarea:focus,
.consultation-form select:focus {
    outline: none;
    border-color: #6a148b;
    box-shadow: 0 0 0 3px rgba(106, 20, 139, 0.1);
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 1);
}

.consultation-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

.consultation-form select option {
    padding: 0.5rem;
    background: white;
    color: #333;
}

.consultation-form input::placeholder,
.consultation-form textarea::placeholder {
    color: #999;
    font-style: italic;
}

.consultation-form textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.btn-submit {
    background: linear-gradient(135deg, #6a148b, #8b1a9c);
    color: white;
    padding: 1.2rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(106, 20, 139, 0.3);
    background: linear-gradient(135deg, #7d1a9f, #9e20b3);
}

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

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
    color: #ff6b6b;
}

/* Custom Alert Styles */
.custom-alert {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #6a148b, #8b1a9c);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    text-align: center;
    min-width: 300px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-alert p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.5;
}

.custom-alert button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.8rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.custom-alert button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        margin: 2% auto;
        width: 95%;
        max-height: 96vh;
        border-radius: 15px;
    }
    
    .modal-header {
        padding: 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 1.5rem;
        max-height: calc(96vh - 120px); /* Adjust for smaller header */
    }
    
    .modal-logo {
        width: 60px;
    }
    
    .consultation-form {
        gap: 1.2rem;
    }
    
    .consultation-form input,
    .consultation-form textarea,
    .consultation-form select {
        padding: 0.8rem;
        font-size: 0.95rem;
    }
    
    .btn-submit {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .modal-close {
        top: 0.5rem;
        right: 1rem;
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
    }
    
    /* Enhanced mobile scrollbar */
    .modal-body::-webkit-scrollbar {
        width: 6px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        margin: 1% auto;
        width: 98%;
        border-radius: 12px;
        max-height: 98vh;
    }
    
    .modal-header {
        padding: 1.2rem;
    }
    
    .modal-body {
        padding: 1.2rem;
        max-height: calc(98vh - 100px); /* Adjust for very small screens */
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .consultation-form input,
    .consultation-form textarea,
    .consultation-form select {
        padding: 0.7rem;
        font-size: 0.9rem;
    }
    
    .consultation-form select {
        padding-right: 2.5rem;
        background-size: 0.8rem;
        background-position: right 0.7rem center;
    }
    
    .custom-alert {
        width: 90%;
        padding: 1.5rem;
    }
    
    .modal-close {
        font-size: 1.3rem;
        width: 30px;
        height: 30px;
    }
    
    /* Mobile-optimized scrollbar */
    .modal-body::-webkit-scrollbar {
        width: 4px;
    }
    
    /* Mobile scroll hint */
    .modal-body.has-scroll::before {
        content: '스크롤 ↓';
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        margin: 1% auto;
        max-height: 98vh;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(98vh - 80px); /* Optimized for landscape */
    }
    
    .modal-logo {
        width: 50px;
        margin-bottom: 0.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .consultation-form {
        gap: 1rem;
    }
    
    .consultation-form input,
    .consultation-form textarea,
    .consultation-form select {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    .btn-submit {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* Animation for form validation states */
.form-error {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1) !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-success {
    border-color: #51cf66 !important;
    box-shadow: 0 0 0 3px rgba(81, 207, 102, 0.1) !important;
}

/* Loading state for submit button */
.btn-submit.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}