/* ===================================
   APPLICATION PAGE STYLES
   =================================== */

/* Page header styles are now in main.css */

/* Application Section */
.application-section {
    padding: 40px 0;
}

/* Application Intro */
.application-intro {
    margin-bottom: 15px;
}

.intro-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-lg);
    padding: 25px;
}

.intro-card h3 {
    font-size: 1.6rem;
    color: var(--color-primary);
    margin-bottom: 15px;
}

.intro-card p {
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.intro-requirements {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--color-bg-elevated);
    border-radius: var(--radius-md);
}

.check-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    font-weight: 700;
    font-size: 1rem;
}

.requirement-item span:last-child {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

/* Application Form */
.application-form {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    position: relative;
}

/* Form Progress Bar - Sticky */
.form-progress-bar {
    position: sticky !important;
    top: 75px !important;
    left: 0;
    right: 0;
    /* width: calc(100% + 80px) !important; */
    width: 100% !important;
    background: var(--color-bg-elevated);
    z-index: 900;
    /* margin: -32px -40px 15px -40px !important; */
    margin-bottom: 15px !important;
    padding: 14px 20px 12px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-lg);
    border-bottom: 1px solid var(--color-border);
}

/* Progress bar background track */
.form-progress-bar::before {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 20px;
    right: 20px;
    height: 6px;
    background: var(--color-bg-primary);
    border-radius: 3px;
    border: 1px solid var(--color-border);
    z-index: 1;
}

/* Progress bar fill wrapper */
.form-progress-fill {
    position: absolute;
    bottom: 12px;
    left: 20px;
    height: 6px;
    max-width: calc(100% - 40px);
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    transition: width 0.3s ease;
    box-shadow: 0 0 15px var(--color-primary-glow);
    border-radius: 3px;
    z-index: 2;
}

.form-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    border-radius: 3px;
}

/* Progress text styling */
.form-progress-text {
    margin-bottom: 10px;
    display: block;
}

.form-section {
    margin-bottom: 35px;
    padding-bottom: 35px;
    border-bottom: 1px solid var(--color-border);
}

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

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.section-number {
    font-size: 2.5rem;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
    opacity: 0.5;
}

.section-header h3 {
    font-size: 1.8rem;
    color: var(--color-text-primary);
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Form styles now use Bootstrap classes with overrides in main.css */

.form-group label,
.form-label {
    display: block;
    color: var(--color-text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    font-family: var(--font-primary) !important;
}

.required {
    color: var(--color-primary);
    margin-left: var(--spacing-xs);
}

/* Keep custom styling for compatibility */
.form-group input:not([type="checkbox"]),
.form-group textarea,
.form-group select,
input:not([type="checkbox"]),
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-family: var(--font-primary) !important;
    font-size: 0.95rem;
    transition: var(--transition-normal);
}

/* Custom select styling */
.form-group select,
select.form-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ff2121' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    padding-right: 40px;
    cursor: pointer;
}

.form-group select option {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    padding: 10px;
}

.form-group input:focus:not([type="checkbox"]),
.form-group textarea:focus,
.form-group select:focus,
input:focus:not([type="checkbox"]),
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    box-shadow: 0 0 0 4px var(--color-primary-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--color-text-muted);
}

/* Readonly and disabled inputs */
.form-group input:read-only:not([type="checkbox"]),
.form-group textarea:read-only,
input:read-only:not([type="checkbox"]),
textarea:read-only,
.form-group input[readonly]:not([type="checkbox"]),
.form-group textarea[readonly],
input[readonly]:not([type="checkbox"]),
textarea[readonly],
.form-group input:disabled:not([type="checkbox"]),
.form-group textarea:disabled,
input:disabled:not([type="checkbox"]),
textarea:disabled {
    background: var(--color-bg-elevated) !important;
    cursor: not-allowed;
    opacity: 0.9;
}

/* Date input calendar icon - red color */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(24%) sepia(98%) saturate(7466%) hue-rotate(356deg) brightness(100%) contrast(114%);
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(13%) sepia(100%) saturate(7431%) hue-rotate(2deg) brightness(105%) contrast(119%);
}

.form-group textarea,
textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.field-hint {
    display: block;
    margin-top: var(--spacing-xs);
    color: var(--color-text-tertiary);
    font-size: 0.9rem;
    font-style: italic;
}

.field-hint a {
    color: var(--color-primary);
    text-decoration: underline;
    transition: var(--transition-fast);
}

.field-hint a:hover {
    color: var(--color-primary-dark);
    text-decoration: none;
}

/* Custom Checkbox Styling */
.custom-checkbox-wrapper {
    margin-bottom: 15px;
    padding: 18px 20px;
    background: var(--color-bg-elevated);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
    display: block;
}

.custom-checkbox-wrapper:hover {
    border-color: var(--color-primary);
    background: var(--color-bg-tertiary);
}

.custom-checkbox-input {
    display: none;
}

.custom-checkbox-label {
    display: inline-grid;
    grid-template-columns: 30px 1fr;
    gap: 14px;
    align-items: center;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
    width: 100%;
}

.custom-checkbox-label .checkbox-icon {
    margin-right: 10px;
    width: 30px;
    height: 30px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: transparent;
    transition: var(--transition-normal);
    flex-shrink: 0;
    grid-column: 1;
}

.custom-checkbox-input:checked + .custom-checkbox-label .checkbox-icon {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 0 10px var(--color-primary-glow);
}

.custom-checkbox-label .checkbox-text {
    color: var(--color-text-secondary);
    line-height: 1.6;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    grid-column: 2;
    align-self: center;
}

.custom-checkbox-input:checked + .custom-checkbox-label .checkbox-text {
    color: var(--color-text-primary);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.form-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
}

.form-actions .btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 0 20px var(--color-primary-glow);
}

.form-actions .btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: 0 0 30px var(--color-primary-glow);
    transform: translateY(-2px);
}

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

.form-actions .btn-secondary {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 2px solid var(--color-border);
}

.form-actions .btn-secondary:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

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

.form-actions .btn-warning {
    background: #ffaa00;
    color: #0a0a0a;
    border: 2px solid #ffaa00;
    font-weight: 600;
}

.form-actions .btn-warning:hover {
    background: #ff9900;
    border-color: #ff9900;
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.5);
    transform: translateY(-2px);
}

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

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

/* Searchable Select Styling */
.searchable-select-wrapper {
    position: relative;
    width: 100%;
}

.searchable-select-input {
    cursor: pointer;
}

.searchable-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: var(--color-bg-elevated);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.searchable-select-dropdown.active {
    display: block;
}

.searchable-select-option {
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
}

.searchable-select-option:last-child {
    border-bottom: none;
}

.searchable-select-option:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-primary);
}

.searchable-select-option.selected {
    background: var(--color-primary);
    color: #ffffff;
}

.searchable-select-dropdown::-webkit-scrollbar {
    width: 8px;
}

.searchable-select-dropdown::-webkit-scrollbar-track {
    background: var(--color-bg-primary);
    border-radius: 4px;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

.form-notice {
    margin-top: 25px;
    padding: 18px;
    background: var(--color-bg-elevated);
    border-left: 4px solid var(--color-info);
    border-radius: var(--radius-md);
}

.form-notice p {
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.7;
}

.form-notice strong {
    color: var(--color-primary);
}

/* Form Validation States */
/* Invalid state - red border (with JS validation classes) */
.form-group input.is-invalid,
.form-group select.is-invalid,
.form-group textarea.is-invalid {
    border-color: var(--color-error) !important;
    box-shadow: 0 0 0 4px rgba(255, 33, 33, 0.1) !important;
}

/* All inputs and textareas focus - RED/PRIMARY */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 4px var(--color-primary-glow) !important;
    outline: none !important;
}

/* Country and Timezone searchable inputs focus */
.country-input-wrapper input:focus,
.timezone-input-wrapper input:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 4px var(--color-primary-glow) !important;
}

/* Country Searchable Input */
.country-wrapper {
    position: relative;
}

.country-input-wrapper {
    position: relative;
}

.country-input-wrapper input {
    padding-right: 35px;
    background: var(--color-bg-primary) !important;
}

.country-input-wrapper input[readonly] {
    cursor: default;
    background: var(--color-bg-elevated) !important;
    opacity: 0.9;
}

.country-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ff3b3b;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 25px;
    height: 25px;
    line-height: 1;
    transition: color 0.3s ease;
}

.country-clear:hover {
    color: #ff0000;
}

.country-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: var(--color-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    transition: all 0.2s ease;
}

.country-dropdown.show {
    max-height: 350px;
    opacity: 1;
    visibility: visible;
}

.country-options {
    max-height: 300px;
    overflow-y: scroll;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.country-option {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--color-text-primary);
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.country-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.country-loading,
.country-no-results {
    padding: 12px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.country-options::-webkit-scrollbar {
    width: 8px;
}

.country-options::-webkit-scrollbar-track {
    background: transparent;
}

.country-options::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.country-options::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Timezone Searchable Input */
.timezone-wrapper {
    position: relative;
}

.timezone-input-wrapper {
    position: relative;
}

.timezone-input-wrapper input {
    padding-right: 35px;
    background: var(--color-bg-primary) !important;
}

.timezone-input-wrapper input[readonly] {
    cursor: default;
    background: var(--color-bg-elevated) !important;
    opacity: 0.9;
}

.timezone-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ff3b3b;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 25px;
    height: 25px;
    line-height: 1;
    transition: color 0.3s ease;
}

.timezone-clear:hover {
    color: #ff0000;
}

.timezone-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: var(--color-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    transition: all 0.2s ease;
}

.timezone-dropdown.show {
    max-height: 350px;
    opacity: 1;
    visibility: visible;
}

.timezone-options {
    max-height: 300px;
    overflow-y: scroll;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.timezone-option {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--color-text-primary);
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.timezone-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.timezone-loading,
.timezone-no-results {
    padding: 12px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.timezone-options::-webkit-scrollbar {
    width: 8px;
}

.timezone-options::-webkit-scrollbar-track {
    background: transparent;
}

.timezone-options::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.timezone-options::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Success Message (for JavaScript) */
.success-message {
    display: none;
    padding: var(--spacing-xl);
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-success);
    border-radius: var(--radius-lg);
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.success-message.show {
    display: block;
}

.success-message h3 {
    color: var(--color-success);
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

.success-message p {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .intro-requirements {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .application-form {
        padding: var(--spacing-lg);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .section-number {
        font-size: 2rem;
    }
    
    .section-header h3 {
        font-size: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .form-progress-bar {
        width: calc(100% + 40px) !important;
        margin: -24px -20px 20px -20px !important;
        padding: 12px 15px 10px 15px;
    }
    
    .form-progress-bar::before {
        left: 15px;
        right: 15px;
        bottom: 10px;
    }
    
    .form-progress-fill {
        left: 15px;
        bottom: 10px;
        max-width: calc(100% - 30px);
    }
}

@media (max-width: 480px) {
    .intro-card {
        padding: var(--spacing-lg);
    }
    
    .form-section {
        padding-bottom: var(--spacing-lg);
    }
    
    .form-progress-bar {
        top: 85px !important;
        padding: 10px 12px 8px 12px;
    }
    
    .form-progress-bar::before {
        left: 12px;
        right: 12px;
        bottom: 8px;
    }
    
    .form-progress-fill {
        left: 12px;
        bottom: 8px;
        max-width: calc(100% - 24px);
    }
}

/* Draft Notification Animations */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Resend Modal Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

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