/**
 * Form Styles
 * Registration form, template selection, and form validation
 */

/* Reset main margins for diploma form */
main:has(.diploma-form-wrapper) {
    margin-top: 0 !important;
    min-height: auto !important;
}

/* Diploma Form Wrapper */
.diploma-form-wrapper {
    background: #f0f4f8;
    min-height: 100vh;
    padding: 100px 20px 60px;
}

.diploma-form-container {
    max-width: 1440px;
    margin: 0 auto;
}

.diploma-form-title {
    text-align: center;
    font-size: 42px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 50px;
    line-height: 1.2;
}

.diploma-form-title .highlight-blue {
    color: #0065B1;
}

/* Main Content Layout */
.diploma-form-content {
    display: grid;
    grid-template-columns: minmax(400px, 600px) 1fr;
    gap: 30px;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}

/* Registration Container - Legacy Support */
.registration-container {
    max-width: 1000px;
    margin: 40px auto;
    background: white;
    border-radius: var(--border-radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* Progress Steps */
.progress-steps {
    display: flex;
    background: var(--bg-light);
    padding: 32px;
    gap: 24px;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--light-purple);
    z-index: 0;
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--light-purple);
    color: var(--text-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    transition: all var(--transition-speed) ease-in-out;
}

.step.active .step-number {
    background: var(--gradient-primary);
    border-color: var(--primary-purple);
    color: white;
}

.step.completed .step-number {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
    color: white;
}

.step-label {
    font-size: 14px;
    color: var(--text-medium);
    text-align: center;
    font-weight: 500;
}

.step.active .step-label {
    color: var(--primary-purple);
    font-weight: 600;
}

/* Step Content */
.step-content {
    padding: 48px;
    display: none;
}

.step-content.active {
    display: block;
}

.step-content h2 {
    margin-bottom: 24px;
    color: var(--text-dark);
}

/* Template Selection Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.template-item {
    position: relative;
    border: 3px solid transparent;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-speed) ease-in-out;
    background: var(--bg-light);
}

.template-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(67,61,136,0.15);
}

.template-item.selected {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 4px rgba(135,66,238,0.2);
}

.template-thumbnail {
    width: 100%;
    aspect-ratio: 1.414;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, var(--light-purple) 0%, var(--bg-light) 100%);
}

.template-name {
    padding: 16px;
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
}

.template-item.selected .template-name {
    background: var(--gradient-primary);
    color: white;
}

.checkmark {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: var(--primary-purple);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.template-item.selected .checkmark {
    display: flex;
}

/* Form Groups */
.form-section {
    margin-bottom: 32px;
}

.form-section h3 {
    color: var(--primary-purple);
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--bg-light);
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

.form-group label.required::after {
    content: '*';
    color: #EE3F58;
    margin-left: 4px;
}

.form-control {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all var(--transition-speed) ease-in-out;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 4px rgba(135,66,238,0.1);
}

.form-control.error {
    border-color: #EE3F58;
}

.form-control.error:focus {
    box-shadow: 0 0 0 4px rgba(238,63,88,0.1);
}

.error-message {
    color: #EE3F58;
    font-size: 13px;
    display: none;
}

.form-control.error + .error-message {
    display: block;
}

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

select.form-control {
    cursor: pointer;
}

/* Checkbox Toggle */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 12px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    font-weight: 500;
    margin: 0;
}

/* Supervisor Section */
.supervisor-section {
    display: none;
    padding: 24px;
    background: #fff9f0;
    border-left: 4px solid #ff9800;
    border-radius: 12px;
    margin-top: 16px;
}

.supervisor-section.active {
    display: block;
}

/* Button Groups */
.form-actions {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid var(--bg-light);
}

.btn-back {
    background: #ebebf0;
    color: var(--text-dark);
}

.btn-back:hover {
    background: #d8d8dd;
    opacity: 1;
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Helper Text */
.helper-text {
    font-size: 13px;
    color: var(--text-medium);
    margin-top: 4px;
}

/* ============================================
   NEW DIPLOMA FORM STYLES
   ============================================ */

/* Left Side - Form */
.diploma-form-left {
    background: #D7EAFC;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Tab Switcher */
.diploma-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    background: transparent;
    border-radius: 0;
    overflow: visible;
}

.diploma-tab {
    flex: 1;
    padding: 16px 24px;
    border: none;
    background: #B8D9F5;
    color: #34314B;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 0;
}

.diploma-tab:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.diploma-tab:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.diploma-tab.active {
    background: #0065B1;
    color: white;
}

.diploma-tab:hover:not(.active) {
    background: #A5CCF0;
}

/* Tab Content */
.diploma-tab-content {
    display: none;
}

.diploma-tab-content.active {
    display: block;
}

/* Form Controls - New Style */
.diploma-form-left .form-group {
    margin-bottom: 14px;
}

.diploma-form-left .form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: all 0.2s ease;
}

.diploma-form-left .form-control:focus {
    outline: none;
    border-color: #0065B1;
    box-shadow: 0 0 0 2px rgba(0, 101, 177, 0.1);
}

.diploma-form-left .form-control::placeholder {
    color: #9ca3af;
    font-size: 14px;
}

/* Form Labels */
.form-label-small {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 6px;
    display: block;
    font-weight: 500;
}

.form-row-inline {
    margin-bottom: 4px;
}

.form-row-inline .form-label-small {
    margin-bottom: 0;
}

/* Helper Links */
.form-helper-link {
    font-size: 13px;
    margin-top: 6px;
    color: #6b7280;
}

.form-helper-link a {
    color: #0065B1;
    text-decoration: none;
    font-weight: 500;
}

.form-helper-link a:hover {
    text-decoration: underline;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 14px 24px;
    background: #EE3F58;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-submit:hover {
    background: #d63548;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(238, 63, 88, 0.25);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Right Side - Preview */
.diploma-form-right {
    position: sticky;
    top: 30px;
}

.diploma-preview-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Main Preview - Now on the left */
.diploma-preview-main {
    flex: 1;
    text-align: center;
    background: #f9fafb;
    border-radius: 12px;
    padding: 30px 20px;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e5e7eb;
}

.diploma-preview-main img {
    max-width: 100%;
    max-height: 700px;
    height: auto;
    width: auto;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Template Gallery - Vertical on the right */
.diploma-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 700px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: #0065B1 #e0e8f0;
    flex-shrink: 0;
    width: 110px;
}

.diploma-gallery::-webkit-scrollbar {
    width: 6px;
}

.diploma-gallery::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.diploma-gallery::-webkit-scrollbar-thumb {
    background: #0065B1;
    border-radius: 3px;
}

.diploma-gallery::-webkit-scrollbar-thumb:hover {
    background: #004d8a;
}

.diploma-gallery-item {
    cursor: pointer;
    border: 3px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
    aspect-ratio: 0.707;
    width: 100%;
    background: white;
}

.diploma-gallery-item:hover {
    transform: translateX(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #0065B1;
}

.diploma-gallery-item.active {
    border-color: #0065B1;
    box-shadow: 0 0 0 3px rgba(0, 101, 177, 0.2);
    transform: translateX(-5px);
}

.diploma-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Responsive */
@media (max-width: 1200px) {
    .diploma-form-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .diploma-form-right {
        position: static;
        order: -1;
    }

    .diploma-form-title {
        font-size: 36px;
    }

    .diploma-preview-container {
        flex-direction: column-reverse;
    }

    .diploma-gallery {
        flex-direction: row;
        width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 10px;
    }

    .diploma-gallery-item {
        width: 80px;
        flex-shrink: 0;
    }

    .diploma-gallery-item:hover,
    .diploma-gallery-item.active {
        transform: translateY(-3px);
    }
}

@media (max-width: 768px) {
    .diploma-form-wrapper {
        padding: 30px 15px;
    }

    .diploma-form-title {
        font-size: 28px;
        margin-bottom: 30px;
    }

    .diploma-form-left {
        padding: 25px;
    }

    .diploma-preview-container {
        padding: 20px;
    }

    .diploma-preview-main {
        min-height: 400px;
        padding: 20px 15px;
    }
}

@media (max-width: 640px) {
    .registration-container {
        margin: 20px 16px;
    }

    .diploma-form-wrapper {
        padding: 20px 10px;
    }

    .diploma-form-title {
        font-size: 24px;
    }

    .diploma-form-left {
        padding: 20px;
        border-radius: 15px;
    }

    .diploma-tabs {
        margin-bottom: 20px;
    }

    .diploma-tab {
        padding: 12px 16px;
        font-size: 14px;
    }

    .diploma-tab:first-child,
    .diploma-tab:last-child {
        border-radius: 0;
    }

    .diploma-tab:first-child {
        border-top-left-radius: 6px;
        border-bottom-left-radius: 6px;
    }

    .diploma-tab:last-child {
        border-top-right-radius: 6px;
        border-bottom-right-radius: 6px;
    }

    .diploma-form-left .form-control {
        font-size: 14px;
        padding: 11px 12px;
    }

    .btn-submit {
        padding: 13px 20px;
        font-size: 14px;
    }

    .step-content {
        padding: 24px;
    }

    .progress-steps {
        padding: 24px 16px;
    }

    .step-label {
        font-size: 12px;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .template-grid {
        grid-template-columns: 1fr;
    }

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

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .diploma-preview-main {
        min-height: 300px;
        padding: 15px;
    }

    .diploma-preview-container {
        flex-direction: column-reverse;
        gap: 15px;
    }

    .diploma-gallery {
        flex-direction: row;
        gap: 8px;
        padding-right: 5px;
    }

    .diploma-gallery-item {
        width: 70px;
    }
}
