/* Advanced Search Page Specific Styles */

/* Page Header - Hidden on advanced search page */
body .page-header {
    display: none !important;
}

/* Form Header Title */
.form-header-title {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
    text-align: center;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background-image: url('../images/visuals/1.png');
    background-size: 20px 20px;
    background-repeat: repeat;
    background-position: center;
    opacity: 0.02;
    z-index: 0;
}

.page-title-section {
    position: relative;
    z-index: 1;
}

.form-header-title .page-title {
    color: #2F2D69;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    padding: 1rem 0;
}

.page-subtitle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    color: #666;
    font-size: 1rem;
    font-weight: 500;
}

.search-icon {
    font-size: 1.2rem;
}

.more-details-link {
    position: relative;
    z-index: 1;
}

.more-details-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.8);
    border: 1px solid #e9ecef;
}

.more-details-btn:hover {
    color: #d32f2f;
    background: rgba(211, 47, 47, 0.1);
    border-color: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(211, 47, 47, 0.2);
}

.details-icon {
    color: #d32f2f;
    font-size: 1.2rem;
}

.advanced-search-form-container {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.advanced-search-form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background-image: url('../images/visuals/2.png');
    background-size: 18px 18px;
    background-repeat: repeat;
    background-position: center;
    opacity: 0.02;
    z-index: 0;
}

.advanced-search-form {
    position: relative;
    z-index: 1;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e9ecef;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section-title {
    color: #2F2D69;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #2F2D69, #1AAB9E);
    color: white;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(47, 45, 105, 0.15);
    position: relative;
    overflow: hidden;
}

.form-section-title::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/visuals/3.png');
    background-size: 15px 15px;
    background-repeat: repeat;
    background-position: center;
    opacity: 0.05;
    z-index: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

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

.form-group label {
    color: #2c3e50;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    padding-right: 0.3rem;
    display: block;
}

.form-group input,
.form-group select {
    padding: 0.75rem 1rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Farhang', sans-serif;
    transition: all 0.3s ease;
    background: white;
    color: #2c3e50;
    line-height: 1.5;
    width: 100%;
    height: auto;
    min-height: 45px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1AAB9E;
    box-shadow: 0 0 0 4px rgba(26, 171, 158, 0.15);
    transform: translateY(-2px);
    border-width: 2px;
}

.form-group input:hover,
.form-group select:hover {
    border-color: #1AAB9E;
    box-shadow: 0 2px 8px rgba(26, 171, 158, 0.1);
}

.form-group input::placeholder {
    color: #adb5bd;
    font-style: normal;
    font-size: 0.9rem;
    opacity: 0.7;
}

.form-group select {
    cursor: pointer;
    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: left 1rem center;
    background-size: 1rem;
    padding-left: 3rem;
}

.form-submit-section {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e9ecef;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.search-submit-btn {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Farhang', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(25, 118, 210, 0.2);
    position: relative;
    overflow: hidden;
    line-height: 1.5;
    min-width: 200px;
}

.search-submit-btn::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 ease;
}

.search-submit-btn:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(25, 118, 210, 0.4);
}

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

.search-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

/* Clear Form Button */
.clear-form-btn {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Farhang', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(108, 117, 125, 0.2);
    position: relative;
    overflow: hidden;
    line-height: 1.5;
    min-width: 200px;
}

.clear-form-btn:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(108, 117, 125, 0.3);
}

.clear-form-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.search-submit-btn i,
.clear-form-btn i {
    margin-left: 0.5rem;
    font-size: 1rem;
}

.page-footer {
    text-align: right;
    margin-top: 0.5rem;
    padding: 0.4rem 0;
}

.page-indicator {
    color: #28a745;
    font-weight: 600;
    font-size: 1rem;
    background: rgba(40, 167, 69, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

/* Advanced Search Form Additional Styles */
.form-group input.error,
.form-group select.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-group input.success,
.form-group select.success {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.form-group input.focused,
.form-group select.focused {
    border-color: #1AAB9E;
    box-shadow: 0 0 0 3px rgba(26, 171, 158, 0.15);
}

.field-error {
    animation: slideDown 0.3s ease;
}

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

.char-counter {
    transition: color 0.3s ease;
}

.clear-form-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

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

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form section animations */
.form-section {
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered animation for form groups */
.form-group {
    animation: fadeInUp 0.6s ease;
    animation-fill-mode: both;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }
.form-group:nth-child(7) { animation-delay: 0.7s; }

/* Enhanced select styling */
.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-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: left 1rem center;
    background-size: 1.2rem;
    padding-left: 2.5rem;
    padding-right: 1rem;
}

.form-group select:focus {
    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='%231AAB9E' 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");
}

/* Enhanced button styling */
.search-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.search-submit-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

/* Enhanced input styling */
.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group input[type="number"] {
    -moz-appearance: textfield;
}

/* Responsive Design for Advanced Search - Mobile Optimized */
@media (max-width: 1024px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1.5rem;
    }
    
    .form-header-title .page-title {
        font-size: 1.6rem;
    }
    
    .advanced-search-form-container {
        padding: 1.5rem;
        margin: 0.5rem;
        border-radius: 12px;
    }
    
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.2rem;
    }
    
    .form-section-title {
        font-size: 1.2rem;
        padding: 0.7rem 1.2rem;
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 1rem;
    }
    
    .form-header-title {
        margin-bottom: 1rem;
        padding-bottom: 0.8rem;
    }
    
    .form-header-title .page-title {
        font-size: 1.4rem;
        padding: 0.8rem 0;
    }
    
    .page-subtitle {
        justify-content: center;
        font-size: 0.9rem;
    }
    
    .advanced-search-form-container {
        padding: 1rem;
        margin: 0.5rem 0;
        border-radius: 10px;
        box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .form-section-title {
        font-size: 1.1rem;
        padding: 0.7rem 1rem;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 0.5rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
        font-weight: 600;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 48px;
        border-radius: 8px;
        -webkit-appearance: none;
        appearance: none;
    }
    
    .form-group input::placeholder {
        font-size: 0.9rem;
    }
    
    .form-submit-section {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    
    .search-submit-btn,
    .clear-form-btn {
        padding: 0.9rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        min-height: 48px;
        border-radius: 8px;
    }
    
    .search-submit-btn i,
    .clear-form-btn i {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .main-content {
        padding: 0.5rem 0;
    }
    
    .page-header {
        padding: 0.75rem;
    }
    
    .form-header-title {
        margin-bottom: 0.8rem;
        padding-bottom: 0.6rem;
    }
    
    .form-header-title .page-title {
        font-size: 1.25rem;
        padding: 0.6rem 0;
        line-height: 1.4;
    }
    
    .page-subtitle {
        font-size: 0.85rem;
        padding: 0.3rem 0;
    }
    
    .more-details-btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.9rem;
        min-height: 40px;
    }
    
    .advanced-search-form-container {
        padding: 0.9rem;
        margin: 0.25rem 0;
        border-radius: 8px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.9rem;
    }
    
    .form-section {
        margin-bottom: 1.2rem;
        padding-bottom: 1.2rem;
    }
    
    .form-section-title {
        font-size: 1rem;
        padding: 0.6rem 0.9rem;
        margin-bottom: 0.9rem;
        line-height: 1.4;
    }
    
    .form-group {
        margin-bottom: 0.4rem;
    }
    
    .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.35rem;
        font-weight: 600;
        line-height: 1.4;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.7rem 0.9rem;
        font-size: 0.95rem;
        min-height: 46px;
        border-radius: 6px;
        line-height: 1.5;
    }
    
    .form-group input::placeholder {
        font-size: 0.875rem;
    }
    
    .form-group select {
        padding-left: 2.2rem;
        background-size: 1rem;
        background-position: left 0.8rem center;
    }
    
    .form-submit-section {
        flex-direction: column;
        gap: 0.65rem;
        margin-top: 1.2rem;
        padding-top: 1.2rem;
    }
    
    .search-submit-btn,
    .clear-form-btn {
        padding: 0.85rem 1.2rem;
        font-size: 0.95rem;
        width: 100%;
        min-height: 46px;
        border-radius: 6px;
        font-weight: 600;
    }
    
    .search-submit-btn i,
    .clear-form-btn i {
        font-size: 0.9rem;
        margin-left: 0.4rem;
    }
    
    .page-indicator {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
        border-radius: 5px;
    }
}

/* Extra Small Devices (320px and below) */
@media (max-width: 360px) {
    .form-header-title .page-title {
        font-size: 1.15rem;
    }
    
    .advanced-search-form-container {
        padding: 0.75rem;
    }
    
    .form-section-title {
        font-size: 0.95rem;
        padding: 0.55rem 0.8rem;
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.65rem 0.8rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .search-submit-btn,
    .clear-form-btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .form-group input:focus,
    .form-group select:focus {
        transform: none;
    }
    
    .search-submit-btn:active,
    .clear-form-btn:active {
        transform: scale(0.98);
    }
    
    /* Larger touch targets */
    .form-group input,
    .form-group select {
        min-height: 48px;
    }
    
    @media (max-width: 480px) {
        .form-group input,
        .form-group select {
            min-height: 46px;
        }
    }
}

/* Mobile Container Optimizations */
@media (max-width: 768px) {
    .main-content .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }
    
    .advanced-search-form {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Better spacing for form sections on mobile */
    .form-section:first-child {
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    .main-content .container {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    /* Ensure all elements fit within viewport */
    * {
        max-width: 100%;
    }
    
    .form-group input,
    .form-group select,
    .search-submit-btn,
    .clear-form-btn {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Improve button spacing on very small screens */
    .form-submit-section {
        padding-left: 0;
        padding-right: 0;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .form-header-title .page-title {
        font-size: 1.2rem;
        padding: 0.5rem 0;
    }
    
    .advanced-search-form-container {
        padding: 1rem;
    }
    
    .form-section {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
    
    .form-grid {
        gap: 0.8rem;
    }
}

/* Improve focus states for mobile accessibility */
@media (max-width: 768px) {
    .form-group input:focus,
    .form-group select:focus {
        outline: 2px solid #1AAB9E;
        outline-offset: 2px;
        border-color: #1AAB9E;
    }
    
    .search-submit-btn:focus,
    .clear-form-btn:focus {
        outline: 2px solid #fff;
        outline-offset: 2px;
    }
}
