:root {
    --color-primary: #012340;
    --color-secondary: #04402F;
    --color-accent: #F2C230;
    --color-accent-dark: #BF8924;
    --color-light: #F2F1F0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--color-light);
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.header {
    background-color: var(--color-primary);
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 5px;
    margin-bottom: 20px;
}

.search-container {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.search-container input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    background-color: var(--color-accent);
    color: var(--color-primary);
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    white-space: nowrap;
}

button:hover {
    background-color: var(--color-accent-dark);
}

.diploma-container {
    background-color: white;
    width: 297mm;  /* A4 landscape */
    height: 210mm;  /* A4 landscape */
    margin: 0 auto;
    padding: 20mm;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    /* Cambiado de display: none a display: block */
    display: block;
}

.diploma-border {
    position: absolute;
    top: 10mm;
    left: 10mm;
    right: 10mm;
    bottom: 10mm;
    border: 2mm solid var(--color-primary);
    border-radius: 5mm;
    pointer-events: none;
}

.inner-border {
    position: absolute;
    top: 15mm;
    left: 15mm;
    right: 15mm;
    bottom: 15mm;
    border: 1mm solid var(--color-accent);
    border-radius: 3mm;
    pointer-events: none;
}

.diploma-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: row;
    height: 100%;
}

.diploma-left {
    width: 25%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding-right: 20px;
    border-right: 1px solid var(--color-accent);
}

.diploma-right {
    width: 75%;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.logo {
    max-width: 120px;
    margin-bottom: 10px;
}

.institution-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
}

.qr-container {
    text-align: center;
    margin-bottom: 10px;
}

.qr-code {
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.qr-text {
    font-size: 12px;
    color: var(--color-primary);
    margin-top: 5px;
    text-align: center;
}

.diploma-title {
    font-size: 36px;
    color: var(--color-secondary);
    margin-bottom: 20px;
    font-weight: bold;
    text-align: center;
}

.diploma-text {
    font-size: 16px;
    text-align: center;
    line-height: 1.5;
    margin-bottom: 15px;
}

.student-name {
    font-size: 28px;
    font-weight: bold;
    color: var(--color-primary);
    margin: 15px 0;
    text-align: center;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 5px;
}

.course-name {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-secondary);
    margin: 10px 0;
    text-align: center;
}

.period {
    font-size: 18px;
    color: var(--color-primary);
    margin: 10px 0;
    text-align: center;
}

.diploma-footer {
    display: flex;
    justify-content: space-around;
    margin-top: 30px;
}

.qr-signature {
    text-align: center;
    width: 30%;
}

.qr-signature .qr-code {
    width: 100px;
    height: 100px;
    margin: 0 auto 10px auto;
}

.qr-signature .qr-text {
    font-weight: bold;
    font-size: 16px;
    color: var(--color-primary);
    margin-top: 5px;
}

/* Añadido: estilos para la firma del director */
.signature-container {
    width: 30%;
    text-align: center;
}

.signature-line {
    width: 80%;
    height: 1px;
    background-color: var(--color-primary);
    margin: 0 auto 10px auto;
}

#diplomaDirector {
    font-weight: bold;
    font-size: 16px;
    color: var(--color-primary);
}

#diplomaDirectorTitle {
    font-size: 14px;
    color: var(--color-secondary);
}

.diploma-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 120px;
    color: rgba(1, 35, 64, 0.05);
    font-weight: bold;
    z-index: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.print-button {
    background-color: var(--color-secondary);
    color: white;
}

.print-button:hover {
    background-color: #032F23;
}

.status-message {
    padding: 20px;
    text-align: center;
    margin-top: 20px;
    border-radius: 5px;
}

.error-message {
    background-color: #ffdddd;
    color: #990000;
    border: 1px solid #990000;
}

.loading-message {
    background-color: #f8f8f8;
    color: #333;
    border: 1px solid #ddd;
}

@media print {
    body * {
        visibility: hidden;
    }
    .diploma-container, .diploma-container * {
        visibility: visible;
    }
    .diploma-container {
        position: absolute;
        left: 0;
        top: 0;
        margin: 0;
        padding: 20mm;
        box-shadow: none;
        display: block !important;
    }
    .actions {
        display: none;
    }
}