/**
 * Service Modal Custom Styling
 * Optimized for mobile responsiveness and accessibility
 */

/* Modal sizing and animation */
#serviceModal .modal-dialog {
    max-width: 480px;
    max-height: 350px;
    margin: 1.75rem auto;
}

#serviceModal .modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    max-height: 500px;
    height: 500px;
    display: flex;
    flex-direction: column;
}

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

/* Modal header */
#serviceModal .modal-header {
    background: linear-gradient(135deg, #BC6C25 0%, #DDA15E 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    padding: 1rem 1.25rem;
    border-bottom: none;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

#serviceModal .modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

#serviceModal .btn-close {
    filter: brightness(0) invert(1);
    font-size: 0.8rem;
    opacity: 0.8;
    min-width: 44px; /* Touch target size */
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#serviceModal .btn-close:hover {
    opacity: 1;
}

/* Accessibility - Focus states */
#serviceModal .btn-close:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.2);
}

/* Modal body with scrolling */
#serviceModal .modal-body {
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 440px;
    height: 100%;
    flex: 1 1 auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Custom scrollbar styling */
#serviceModal .modal-body::-webkit-scrollbar {
    width: 6px;
}

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

#serviceModal .modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #BC6C25 0%, #DDA15E 100%);
    border-radius: 10px;
}

#serviceModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a35d1f 0%, #d49954 100%);
}

/* For Firefox */
#serviceModal .modal-body {
    scrollbar-width: thin;
    scrollbar-color: #BC6C25 #f1f1f1;
}

/* Scroll shadow indicators */
#serviceModal .modal-body {
    background:
        /* Shadow covers */
        linear-gradient(white 30%, rgba(255,255,255,0)),
        linear-gradient(rgba(255,255,255,0), white 70%) 0 100%,

        /* Shadows */
        radial-gradient(farthest-side at 50% 0, rgba(188, 108, 37, 0.2), rgba(0,0,0,0)),
        radial-gradient(farthest-side at 50% 100%, rgba(188, 108, 37, 0.2), rgba(0,0,0,0)) 0 100%;
    background-repeat: no-repeat;
    background-color: white;
    background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
    background-attachment: local, local, scroll, scroll;
}

/* AI Generation Section */
.ai-generation-section {
    background: linear-gradient(135deg, #fff8f0 0%, #ffefd5 100%);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.ai-generation-section h6 {
    font-size: 0.85rem;
    font-weight: 600;
    color: #BC6C25;
    margin-bottom: 0.75rem;
}

/* Form labels and inputs */
#serviceModal .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.35rem;
}

#serviceModal .form-control,
#serviceModal textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    transition: all 0.3s ease;
    color: #333;
    background-color: #fff;
    min-height: 44px; /* Touch-friendly */
}

#serviceModal .form-control:hover,
#serviceModal textarea:hover {
    background-color: #fff;
    color: #333;
}

#serviceModal .form-control:focus,
#serviceModal textarea:focus {
    border-color: #BC6C25;
    box-shadow: 0 0 0 0.15rem rgba(188, 108, 37, 0.15);
    background-color: #fff;
    color: #333;
}

#serviceModal .form-control:focus-visible,
#serviceModal textarea:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

/* Placeholder styling */
#serviceModal .form-control::placeholder,
#serviceModal textarea::placeholder {
    color: #999;
    opacity: 1;
}

#serviceModal .form-control::-webkit-input-placeholder,
#serviceModal textarea::-webkit-input-placeholder {
    color: #999;
    opacity: 1;
}

#serviceModal .form-control::-moz-placeholder,
#serviceModal textarea::-moz-placeholder {
    color: #999;
    opacity: 1;
}

#serviceModal .form-control:-ms-input-placeholder,
#serviceModal textarea:-ms-input-placeholder {
    color: #999;
    opacity: 1;
}

#serviceModal textarea {
    resize: vertical;
}

#serviceModal #summary {
    min-height: 55px;
}

#serviceModal #description {
    min-height: 80px;
}

/* Divider text */
#serviceModal .text-center small {
    font-size: 0.75rem;
    color: #888;
    font-style: italic;
}

/* Buttons */
#serviceModal .btn {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.65rem 1.25rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-height: 44px; /* Touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#serviceModal .btn:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.2);
}

#serviceModal #cancelBtn {
    background: transparent;
    color: #BC6C25;
    border: 2px solid #BC6C25;
}

#serviceModal #cancelBtn:hover {
    background: #BC6C25;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(188, 108, 37, 0.3);
}

#serviceModal #generateBtn {
    background: linear-gradient(135deg, #BC6C25 0%, #DDA15E 100%);
    color: white;
    border: none;
}

#serviceModal #generateBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(188, 108, 37, 0.3);
}

#serviceModal #submitBtn {
    background: linear-gradient(135deg, #BC6C25 0%, #DDA15E 100%);
    color: white;
    border: none;
    width: 100%;
}

#serviceModal #submitBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(188, 108, 37, 0.3);
}

#serviceModal #submitBtn:disabled,
#serviceModal #generateBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Form spacing */
#serviceModal .row {
    margin-bottom: 0;
}

#serviceModal .mb-3 {
    margin-bottom: 0.6rem !important;
}

#serviceModal .mb-4 {
    margin-bottom: 0.8rem !important;
}

#serviceModal .my-3 {
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

/* Alert styling */
#serviceModal .alert {
    font-size: 0.8rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

#serviceModal .alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

#serviceModal .alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Invalid feedback */
#serviceModal .invalid-feedback {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

#serviceModal .is-invalid {
    border-color: #dc3545;
}

#serviceModal .is-invalid:focus {
    box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.15);
}

/* Required asterisk */
#serviceModal sup {
    font-size: 0.7rem;
}

/* Responsive adjustments - PRIMARY TARGET: Standard Phones (481px-768px) */
@media (max-width: 768px) {
    #serviceModal .modal-dialog {
        max-width: 96%;
        margin: 0.75rem auto;
        max-height: 90vh; /* Use viewport height */
    }

    #serviceModal .modal-content {
        max-height: 90vh;
        height: auto;
        min-height: 500px;
    }

    #serviceModal .modal-body {
        max-height: calc(90vh - 80px); /* Minus header */
        padding: 1rem;
    }

    #serviceModal .modal-header {
        padding: 0.875rem 1rem;
    }

    #serviceModal .modal-title {
        font-size: 1.05rem;
    }

    /* Maintain 16px font to prevent iOS zoom */
    #serviceModal .form-label {
        font-size: 0.9rem;
    }

    #serviceModal .form-control,
    #serviceModal textarea,
    #serviceModal .btn {
        font-size: 16px;
    }

    /* Improved spacing on mobile */
    .ai-generation-section {
        padding: 0.875rem;
        margin-bottom: 0.875rem;
    }

    #serviceModal .mb-3 {
        margin-bottom: 0.75rem !important;
    }
}

/* Small phones */
@media (max-width: 576px) {
    #serviceModal .modal-dialog {
        max-width: 98%;
        margin: 0.5rem auto;
    }

    #serviceModal .modal-content {
        border-radius: 12px;
    }

    #serviceModal .modal-body {
        padding: 0.875rem;
    }

    #serviceModal .modal-title {
        font-size: 1rem;
    }

    .ai-generation-section {
        padding: 0.75rem;
    }
}

/* Tablet adjustments */
@media (min-width: 577px) and (max-width: 768px) {
    #serviceModal .modal-dialog {
        max-height: 500px;
    }

    #serviceModal .modal-content {
        max-height: 500px;
        height: 500px;
    }

    #serviceModal .modal-body {
        max-height: 440px;
    }
}

/* Menu Service Link Button Styling */
.menu-service-link {
    background: linear-gradient(135deg, #BC6C25 0%, #DDA15E 100%);
    color: white !important;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px; /* Touch target */
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(188, 108, 37, 0.2);
}

.menu-service-link:focus-visible {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.2);
}

.menu-service-link:hover {
    background: linear-gradient(135deg, #DDA15E 0%, #BC6C25 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(188, 108, 37, 0.35);
    text-decoration: none;
}

.menu-service-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(188, 108, 37, 0.3);
}

/* Responsive adjustments for menu service link */
@media (max-width: 768px) {
    .menu-service-link {
        padding: 10px 18px;
        font-size: 14px;
        min-height: 44px; /* Maintain touch target */
    }
}
