body {
    font-family: 'Roboto', sans-serif;
    background-color: #eef2f5;
    margin: 0;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px; /* Adjusted padding for mobile */
}

.main-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    width: 100%;
    max-width: 1200px;
}

.form-container {
    flex: 1;
    min-width: 300px; /* Adjusted for better responsiveness */
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* FIX: Responsive Site Header */
.site-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
}

.site-logo {
    height: 45px; /* Set a consistent height */
    width: auto;  /* Allow width to scale automatically */
    flex-shrink: 0; /* Prevents the logo from shrinking too much */
}

.site-header h1 {
    margin: 0;
    font-size: 24px;
    color: #2c3e50;
    line-height: 1.2;
}

.form-container .tagline {
    margin: 0 0 25px 0;
    font-size: 14px;
    color: #7f8c8d;
}

label {
    display: block;
    font-weight: 500;
    margin: 15px 0 5px;
    font-size: 14px;
}

input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    background-color: #fafafa;
}

input[type="file"] {
    font-size: 14px;
}

.input-note {
    font-size: 12px;
    color: #95a5a6;
    margin-top: 5px;
}

.form-row {
    display: flex;
    flex-direction: column; /* Stack on mobile by default */
    gap: 0;
}

/* Make form rows side-by-side on larger screens */
@media (min-width: 500px) {
    .form-row {
        flex-direction: row;
        gap: 20px;
    }
}

.form-col {
    flex: 1;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#downloadJPEG {
    background-color: #3498db;
    color: white;
}
#downloadJPEG:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

#downloadPDF {
    background-color: #e74c3c;
    color: white;
}
#downloadPDF:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}
button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.preview-container {
    flex-basis: 450px;
    position: sticky;
    top: 40px;
    width: 100%;
    display: flex;
    justify-content: center; /* Center the card on mobile */
}

/* ID Card Styling */
.id-card {
    width: 323px;
    height: 512px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
    position: relative;
    flex-shrink: 0; /* Prevent card from shrinking */
}

.card-background {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    z-index: 1;
}

.card-design-pattern {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: 2;
}

.card-content-wrapper {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.id-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
}

#logoPreview {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

#institutionNamePreview {
    font-family: 'Merriweather', serif;
    font-size: 20px;
    font-weight: 700;
    color: #002244; /* Dark blue */
    margin: 0;
}

.id-card-body {
    padding: 20px 0;
}

.student-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.id-card-content {
    padding: 0 20px;
}

.id-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #002244;
    margin: 15px 0 10px 0;
}

.student-name-preview {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 15px 0;
}

.id-card-content p {
    margin: 6px 0;
    font-size: 13px;
    color: #555;
}

.id-card-content p strong {
    font-weight: 500;
    color: #333;
}

.id-card-footer {
    margin-top: auto;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#footerLogoPreview {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

#footerInstitutionNamePreview {
    font-family: 'Merriweather', serif;
    font-size: 14px;
    font-weight: 700;
    color: #555;
    margin: 0;
}

.disclaimer {
    font-size: 12px;
    text-align: center;
    color: #95a5a6;
    margin-top: 20px;
}