/**
 * Phase 9 Enhanced Member Registration Form Styles - Complete Implementation
 * Includes all Phase 9 requirements and enhancements
 */

/* Import base registration styles */
@import url('./member-registration.css');

/* Phase 9 Enhanced Container */
.kgmb-registration-container.phase9-enhanced {
    max-width: 1400px;
    padding: 2rem;
    background: linear-gradient(135deg, #fffefc 0%, #eeece7 100%);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

/* FI DAN POTONGAN BULANAN Section */
.fi-potongan-section {
    background: #ffffff;
    border: 2px solid #4a3427;
    border-radius: 12px;
    margin-bottom: 3rem;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(22, 101, 52, 0.1);
}

.fi-potongan-title {
    background: #4a3427;
    color: white;
    font-size: 20px !important;
    font-weight: 700;
    margin: 0;
    padding: 1rem 2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fi-potongan-table-container {
    padding: 2rem;
    background: #f8fafc;
}

.fi-potongan-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.fi-potongan-table thead {
    background: #706358;
    color: white;
}

.fi-potongan-table th,
.fi-potongan-table td {
    padding: 1rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.fi-potongan-table th {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.fi-potongan-table tbody tr:hover {
    background-color: #f1f5f9;
}

.fi-potongan-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.fi-potongan-note {
    text-align: center;
    margin: 1rem 0 0 0;
    padding: 1rem;
    background: #e4ddd8;
    border-radius: 0 0 8px 8px;
}

.fi-potongan-note a {
    color: #5e420b
    text-decoration: none;
    font-weight: 600;
}

.fi-potongan-note a:hover {
    text-decoration: underline;
}

/* Phase 9 Form Enhancements */
.phase9-form .form-section {
    margin-bottom: 2.5rem;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.phase9-form .form-section:hover {
    border-color: #cbd5e1;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.phase9-form .section-header {
    background: #706358;
    position: relative;
    overflow: hidden;
}

.phase9-form .section-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.phase9-form .form-section:hover .section-header::before {
    transform: translateX(100%);
}

/* IC Auto-population Enhancement */
#new_ic {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23166534'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 10V3L4 14h7v7l9-11h-7z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 20px 20px;
    padding-right: 3rem;
}

#new_ic:focus {
    background-image: none;
}

/* Auto-populated fields styling */
#date_of_birth[readonly],
#gender:disabled {
    background-color: #f4efeb;
    border-color: #9f836b;
    color: #0c4a6e;
    cursor: not-allowed;
}

#date_of_birth[readonly]:focus,
#gender:disabled:focus {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Occupation dropdown with custom input */
#occupation-custom-row {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding: inherit;
    }
}

#occupation_custom {
    border: 2px dashed #5e420b
    background-color: #f0fdf4;
}

#occupation_custom:focus {
    border-style: solid;
    background-color: white;
}

/* Work Since Year Auto-suggest */
.year-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.year-suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
}

.year-suggestion-item:hover,
.year-suggestion-item.highlighted {
    background-color: #f0fdf4;
    color: #5e420b
}

.year-suggestion-item:last-child {
    border-bottom: none;
}

/* Enhanced Bank Selection */

#bank_account {
    position: relative;
    transition: all 0.3s ease;
}

#bank_account.validating {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3e%3cpath stroke='%23f59e0b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 20px 20px;
}

#bank_account.valid {
    border-color: #059669;
    background-color: #f0fdf4;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3e%3cpath stroke='%23059669' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 13l4 4L19 7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 20px 20px;
}

#bank-account-help {
    font-weight: 500;
    color: #64748b;
    transition: all 0.3s ease;
}

#bank-account-help.active {
    color: #5e420b
    font-weight: 600;
}

/* Enhanced Document Upload Section */
.phase9-form .file-upload-container {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fafafa 0%, #f1f5f9 100%);
}

.phase9-form .file-upload-container:hover {
    border-color: #706358;
    background: #e4ddd8;
}

.phase9-form .file-upload-container.has-file {
    border-color: #059669;
    border-style: solid;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.file-upload-label:hover {
    background-color: rgba(22, 101, 52, 0.05);
}

.file-upload-label .icon {
    width: 32px;
    height: 32px;
    stroke: #5e420b
}

.file-selected {
    margin-top: 1rem;
    font-weight: 600;
    color: #5e420b
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #d1fae5;
}

/* Document Links */
.file-download-link,
.file-example-link,
.file-help-link {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: #5e420b;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.file-download-link:hover,
.file-example-link:hover,
.file-help-link:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 101, 52, 0.3);
    color: white;
    text-decoration: none;
}

/* Uploaded Files Viewer */
.uploaded-files-viewer {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.uploaded-files-viewer h4 {
    margin: 0 0 1rem 0;
    color: #374151;
    font-size: 1.1rem !important;
}

.uploaded-files-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.uploaded-file-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.uploaded-file-item:hover {
    border-color: #5e420b
    box-shadow: 0 2px 8px rgba(22, 101, 52, 0.1);
}

.uploaded-file-icon {
    width: 32px;
    height: 32px;
    background: #5e420b
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.75rem;
}

.uploaded-file-info {
    flex: 1;
}

.uploaded-file-name {
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
}

.uploaded-file-size {
    font-size: 0.8rem;
    color: #64748b;
}

/* Terms and Conditions Link */
.terms-link {
    color: #5e420b
    text-decoration: underline;
    font-weight: 600;
    transition: all 0.3s ease;
}

.terms-link:hover {
    color: #15803d;
    text-decoration: none;
}

/* Enhanced Checkbox */
.phase9-form .checkbox-container input[type="checkbox"] {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #5e420b
    border-radius: 6px;
    position: relative;
}

.phase9-form .checkbox-container input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #166534, #15803d);
    border-color: #5e420b
}

.phase9-form .checkbox-container input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Enhanced Form Actions */
.phase9-form .form-actions {
    background: transparent;
    padding: 2rem;
    border-radius: 12px;
    border: transparent;
    margin-top: 3rem;
}

.phase9-form .btn-primary {
    background: linear-gradient(135deg, #4a3427, #706358);
    border: none;
    box-shadow: 0 4px 15px rgba(22, 101, 52, 0.3);
    font-size: 1.1rem;
    padding: 1rem 2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.phase9-form .btn-primary::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;
}

.phase9-form .btn-primary:hover::before {
    left: 100%;
}

.phase9-form .btn-primary:hover {
    background: linear-gradient(135deg, #15803d, #166534);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 101, 52, 0.4);
}

/* Enhanced Messages */
.phase9-form .registration-message {
    border-radius: 8px;
    border-left: 4px solid;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.phase9-form .registration-message.success {
    border-left-color: #059669;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
}

.phase9-form .registration-message.error {
    border-left-color: #dc2626;
    background: linear-gradient(135deg, #fef2f2, #fecaca);
}

.phase9-form .registration-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* Enhanced Loading States */
.phase9-form .btn.loading {
    background: linear-gradient(135deg, #64748b, #475569);
    cursor: not-allowed;
    transform: none;
}

.phase9-form .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 1s linear infinite;
}

/* Validation Enhancement */
.phase9-form .form-control.is-valid {
    border-color: #059669;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3e%3cpath stroke='%23059669' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 13l4 4L19 7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 16px;
    padding-right: 3rem;
}

.phase9-form .form-control.is-invalid {
    border-color: #dc2626;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3e%3cpath stroke='%23dc2626' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 18L18 6M6 6l12 12'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 16px;
    padding-right: 3rem;
}

/* Progress Indicator */
.form-progress {
    position: sticky;
    top: 0;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
    margin-bottom: 2rem;
    z-index: 100;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #166534, #15803d);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .kgmb-registration-container.phase9-enhanced {
        padding: 1rem;
        margin: 1rem;
    }
    
    .fi-potongan-table-container {
        padding: 1rem;
        overflow-x: auto;
    }
    
    .fi-potongan-table {
        min-width: 600px;
    }
    
    .fi-potongan-table th,
    .fi-potongan-table td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .uploaded-files-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .fi-potongan-title {
        font-size: 1.1rem !important;
        padding: 1rem;
    }
    
    .phase9-form .btn-primary {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
    
    .file-upload-label .icon {
        width: 24px;
        height: 24px;
    }
}