/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Color Palette Variables */
:root {
    /* Primary Colors */
    --primary-dark-green: rgb(41, 92, 82);     /* #295C52 */
    --primary-brown: rgb(121, 68, 30);         /* #79441E */
    --primary-cream: rgb(239, 236, 225);       /* #EFECE1 */
    
    /* Secondary Colors */
    --secondary-dark-blue: rgb(32, 77, 100);   /* #204D64 */
    --secondary-gray: rgb(92, 93, 96);         /* #5C5D60 */
    --secondary-light-gray: rgb(235, 235, 236); /* #EBEBEC */
    
    /* Utility Colors */
    --white: #ffffff;
    --error-red: #e74c3c;
    --success-green: #27ae60;
    --warning-yellow: #f39c12;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--primary-dark-green);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    color: var(--white);
    font-size: 2rem;
    font-weight: 400;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Referral Form Section */
.referral-form-section {
    background: var(--white);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.referral-form-section h2 {
    color: var(--secondary-dark-blue);
    font-size: 1.8rem;
    font-weight: 500;
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 2px solid var(--secondary-light-gray);
    padding-bottom: 15px;
}

/* Form Styles */
.referral-form {
    max-width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--secondary-dark-blue);
    font-size: 0.95rem;
}

.form-group label.required::after {
    content: " *";
    color: var(--error-red);
    font-weight: bold;
}

.form-group label.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-brown);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--secondary-light-gray);
    padding-bottom: 8px;
}

/* Submit Section - Bottom */
.submit-section-bottom {
    background: var(--white);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.submit-note {
    margin-top: 12px;
    color: var(--secondary-gray);
    font-size: 0.9rem;
    font-style: italic;
}

/* Radio Button Styles */
.radio-group {
    margin-bottom: 25px;
}

.radio-options {
    display: flex;
    gap: 30px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
    user-select: none;
    position: relative;
    padding-left: 30px;
}

.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.radio-mark {
    position: absolute;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--white);
    border: 2px solid var(--secondary-light-gray);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.radio-label:hover input[type="radio"] ~ .radio-mark {
    border-color: var(--primary-brown);
}

.radio-label input[type="radio"]:checked ~ .radio-mark {
    background-color: var(--primary-brown);
    border-color: var(--primary-brown);
}

.radio-mark:after {
    content: "";
    position: absolute;
    display: none;
}

.radio-label input[type="radio"]:checked ~ .radio-mark:after {
    display: block;
}

.radio-label .radio-mark:after {
    left: 6px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--white);
}

/* Multiple Referrals Message */
.multiple-referrals-message {
    margin-bottom: 25px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

.multiple-referrals-message.show {
    opacity: 1;
    max-height: 250px;
}

.info-message {
    background: linear-gradient(135deg, var(--primary-cream), var(--secondary-light-gray));
    border: 2px solid var(--primary-brown);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.info-message h3 {
    color: var(--primary-brown);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.info-message p {
    color: var(--secondary-dark-blue);
    font-size: 1rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.info-message p:last-child {
    margin-bottom: 0;
    font-weight: 500;
}

/* Single Referral Form Transition */
#singleReferralForm {
    opacity: 1;
    max-height: none;
    overflow: visible;
    transition: all 0.3s ease-in-out;
}

#singleReferralForm.hide {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

/* Other Reason Field Transition */
.other-reason-field {
    margin-top: 15px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}

.other-reason-field.show {
    opacity: 1;
    max-height: 100px;
}

/* Input Styles */
.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--secondary-light-gray);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-brown);
    box-shadow: 0 0 0 3px rgba(121, 68, 30, 0.1);
}

.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%235C5D60' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Checkbox Styles */
.checkbox-group {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 12px;
    font-weight: 400;
    user-select: none;
    position: relative;
    padding-left: 35px;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--white);
    border: 2px solid var(--secondary-light-gray);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.checkbox-label:hover input[type="checkbox"] ~ .checkmark {
    border-color: var(--primary-brown);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark {
    background-color: var(--primary-brown);
    border-color: var(--primary-brown);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark:after {
    display: block;
}

.checkbox-label .checkmark:after {
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Checkbox Grid for Referral Reasons */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 15px;
}

@media (min-width: 600px) {
    .checkbox-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Upload Area */
.upload-area {
    background: var(--white);
    border: 3px dashed var(--secondary-light-gray);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.upload-area:hover {
    border-color: var(--primary-brown);
    background: var(--primary-cream);
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.upload-area.dragover {
    border-color: var(--primary-brown);
    background: var(--primary-cream);
    transform: scale(1.02);
}

/* Required Upload State */
.upload-area.required-upload {
    border-color: var(--error-red);
    background: #fef9f9;
}

.upload-area.required-upload:hover {
    border-color: #c0392b;
    background: #fef5f5;
}

.upload-area.required-upload #uploadDescription {
    color: var(--error-red);
    font-weight: 500;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    color: var(--primary-brown);
    margin-bottom: 20px;
}

.upload-area h3 {
    color: var(--secondary-dark-blue);
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 500;
}

.upload-area p {
    color: var(--secondary-gray);
    font-size: 1rem;
}

/* File List */
.file-list {
    background: var(--white);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.file-list h3 {
    color: var(--secondary-dark-blue);
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 500;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--primary-cream);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: var(--secondary-light-gray);
    transform: translateX(5px);
}

.file-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-brown), var(--secondary-dark-blue));
    color: var(--white);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 15px;
}

.file-details h4{
    color: var(--secondary-dark-blue);
    font-size: 1rem;
    margin-bottom: 3px;
    font-weight: 500;
}

.file-details p {
    color: var(--secondary-gray);
    font-size: 0.85rem;
}

.remove-file {
    background: var(--error-red);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.remove-file:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Buttons */
.upload-btn {
    background: linear-gradient(135deg, var(--primary-brown), var(--secondary-dark-blue));
    color: var(--white);
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(121, 68, 30, 0.4);
}

.upload-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(121, 68, 30, 0.6);
}

.upload-btn:disabled {
    background: var(--secondary-gray);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Progress */
.upload-progress {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.upload-progress h3 {
    color: var(--secondary-dark-blue);
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 500;
}

.progress-container {
    position: relative;
    width: 100%;
    height: 8px;
    background: var(--secondary-light-gray);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-brown), var(--secondary-dark-blue));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: var(--secondary-gray);
    font-size: 1.1rem;
    font-weight: 500;
}

/* Results */
.upload-results {
    background: var(--white);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.upload-results h3 {
    color: var(--success-green);
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 500;
}

/* Folder Header */
.folder-header {
    background: linear-gradient(135deg, var(--primary-cream), var(--secondary-light-gray));
    border: 2px solid var(--primary-brown);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
}

.folder-header h4 {
    color: var(--primary-brown);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.folder-header p {
    color: var(--secondary-dark-blue);
    font-size: 0.95rem;
    margin: 0;
    opacity: 0.8;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid transparent;
}

.result-success {
    background: #d4edda;
    border-left-color: var(--success-green);
}

.result-error {
    background: #f8d7da;
    border-left-color: var(--error-red);
}

.result-info h4 {
    font-size: 1rem;
    margin-bottom: 5px;
    font-weight: 500;
}

.result-success .result-info h4 {
    color: #155724;
}

.result-error .result-info h4 {
    color: #721c24;
}

.result-info p {
    font-size: 0.9rem;
    margin: 2px 0;
}

.result-success .result-info p {
    color: #155724;
}

.result-error .result-info p {
    color: #721c24;
}

.result-info a {
    color: var(--secondary-dark-blue);
    text-decoration: none;
}

.result-info a:hover {
    text-decoration: underline;
}

.status-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.status-success {
    background: var(--success-green);
    color: var(--white);
}

.status-error {
    background: var(--error-red);
    color: var(--white);
}

/* Config section */
.config-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--warning-yellow);
    border: 1px solid #e67e22;
    border-radius: 10px;
    text-align: center;
}

.config-section h3 {
    color: #8e4b00;
    margin-bottom: 10px;
}

.config-section p {
    color: #8e4b00;
    margin-bottom: 15px;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px 15px;
    }
    
    header h1 {
        font-size: 1.75rem;
    }

    header {
        margin-bottom: 15px;
    }

    .referral-form-section {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .radio-options {
        flex-direction: column;
        gap: 15px;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
    
    .file-list, .upload-progress, .upload-results, .submit-section-bottom {
        padding: 20px;
    }

    .folder-header h4 {
        font-size: 1.1rem;
        flex-direction: column;
        gap: 4px;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .upload-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .referral-form-section, .submit-section-bottom {
        padding: 18px;
    }

    .upload-area {
        padding: 25px 15px;
    }
    
    .upload-btn {
        width: 100%;
    }
}