/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f0f4f8;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #1a365d 0%, #2d5aa0 100%);
    color: white;
    border-radius: 12px;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.header-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header-content p {
    font-size: 1rem;
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto;
}

/* Main Content Layout */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Form Section */
.form-section, .preview-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.section-header {
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
}

.section-header h2 {
    color: #1a365d;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header p {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Form Styles */
form {
    padding: 30px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1a365d;
    font-size: 0.95rem;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: #2d5aa0;
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 90, 160, 0.1);
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 30px;
    margin-top: 10px;
    align-items: center; /* Add this */
}

.radio-option {
    display: flex;
    align-items: center; /* Make sure this is set */
    cursor: pointer;
    font-size: 1rem;
    white-space: nowrap; /* Prevent label from wrapping */
}

.radio-option input[type="radio"] {
    margin-right: 8px;
    margin-bottom: 0; /* Ensure no bottom margin */
}

/* Instructions Box */
.instructions {
    background: #e8f4ff;
    padding: 20px;
    border-radius: 8px;
    margin: 25px 0;
    border-left: 4px solid #2d5aa0;
}

.instructions h4 {
    color: #1a365d;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.instructions ol {
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(to right, #2d5aa0, #1a365d);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(45, 90, 160, 0.3);
}

.btn-success {
    background: linear-gradient(to right, #28a745, #1e7e34);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
}

.btn-success:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.btn-secondary {
    background: linear-gradient(to right, #6c757d, #495057);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 117, 125, 0.3);
}

/* Preview Section */
.preview-container {
    padding: 30px;
    height: 100%;
}

#pdfPreview {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    height: 100%;
    min-height: 800px;
    overflow: hidden;
    position: relative;
}

.preview-content {
    padding: 40px;
    height: 100%;
    font-family: 'Times New Roman', serif;
    font-size: 16px;
    line-height: 1.8;
}

/* Application Preview Layout */
.application-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #1a365d;
}

.application-date {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.to-section p {
    margin-bottom: 6px;
    font-size: 16px;
}

.subject-line {
    margin: 25px 0;
    font-size: 18px;
    font-weight: bold;
    color: #1a365d;
}

.salutation {
    margin: 20px 0;
    font-size: 16px;
}

.application-text {
    margin: 25px 0;
    font-size: 16px;
    line-height: 1.8;
}

.camp-details {
    margin: 30px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    width: 80%;
}

.detail-item {
    margin-bottom: 15px;
    display: flex;
}

.detail-label {
    font-weight: bold;
    min-width: 80px;
}

.detail-value {
    margin-left: 10px;
}

/* FIXED SIGNATURE SECTION - NO MORE COLLIDING */
.signature-section {
    margin-top: 80px;
    padding-top: 40px;
    border-top: 1px solid #e0e0e0;
}

.signature-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    margin-top: 40px;
}

.signature-box {
    flex: 1;
    text-align: center;
    min-width: 0; /* Prevents overflow */
}

.signature-line {
    display: block;
    width: 200px;
    height: 1px;
    background: #333;
    margin: 60px auto 10px;
}

.signature-name {
    font-weight: bold;
    font-size: 14px;
    margin: 5px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

.signature-title {
    font-size: 13px;
    color: #666;
    font-style: italic;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

/* Special styling for applicant "(ME)" */
.applicant-me {
    font-size: 12px;
    color: #444;
    margin-top: 3px;
    font-style: normal;
}

/* Preview Actions */
.preview-actions {
    margin-top: 20px;
    text-align: center;
}

/* Footer */
footer {
    background: #1a365d;
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    margin-top: 40px;
}

.footer-content p {
    margin-bottom: 8px;
}

.footer-note {
    font-size: 0.9rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .header-content h1 {
        font-size: 1.9rem;
    }
    
    .signature-container {
        gap: 30px;
    }
    
    .signature-line {
        width: 180px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    header {
        padding: 20px;
    }
    
    .header-content h1 {
        font-size: 1.7rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .preview-content {
        padding: 25px;
    }
    
    .camp-details {
        width: 100%;
        padding: 20px;
    }
    
    .signature-container {
        flex-direction: column;
        gap: 50px;
        align-items: center;
    }
    
    .signature-box {
        width: 100%;
        max-width: 250px;
    }
    
    .signature-line {
        width: 220px;
        margin-top: 40px;
    }
    
    .signature-name,
    .signature-title {
        max-width: 220px;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    form, .preview-container {
        padding: 20px;
    }
    
    .section-header {
        padding: 15px 20px;
    }
    
    .preview-content {
        padding: 20px;
        font-size: 15px;
    }
    
    .camp-details {
        padding: 15px;
    }
    
    .signature-line {
        width: 180px;
    }
    
    .signature-name {
        font-size: 13px;
    }
    
    .signature-title {
        font-size: 12px;
    }
}

/* Print-specific styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .print-section, .print-section * {
        visibility: visible;
    }
    
    .print-section {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        font-family: 'Times New Roman', serif;
    }
    
    .no-print {
        display: none !important;
    }
    
    .signature-section table {
        width: 100%;
        margin-top: 50px;
    }
}