/* Genel Ayarlar */
html, body {
    height: 100%; /* HTML ve Body'nin tam ekran yüksekliğini almasını sağla */
    margin: 0; /* Varsayılan marginleri kaldır */
    padding: 0; /* Varsayılan paddingleri kaldır */
    overflow: hidden; /* Sayfanın genel kaydırmasını engelle */
}

body {
    font-family: 'Roboto', sans-serif; /* Daha profesyonel font */
    background-color: #f4f7f6;
    display: flex;
    flex-direction: column; /* İçeriğin dikey olarak sıralanmasını sağlar */
    align-items: center; /* İçeriği yatayda ortala */
    color: #333;
    /* Footer için alttan boşluk bırakmayacağız, çünkü ayrı yönetilecek */
}

.main-content-wrapper {
    flex-grow: 1; /* Mevcut alanı doldurmasını sağlar */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    overflow-y: auto; /* İçerik taşarsa kendi içinde kaydırma çubuğu oluşur */
    padding: 20px 0; /* İçeriğin üstten ve alttan boşluğunu ayarla */
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
    /* margin: 20px 0; bu satırı kaldırdık, .main-content-wrapper padding'i var */
}

h1 {
    font-family: 'Playfair Display', serif; /* Başlık için farklı font */
    color: #2c3e50;
    text-align: center;
    margin-bottom: 25px;
    font-size: 2.5em;
    font-weight: 700;
}

/* Giriş Alanları Stili */
.input-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.input-section input[type="text"],
.input-section input[type="date"],
.input-section textarea,
.input-section select {
    width: calc(100% - 20px);
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.input-section input[type="text"]:focus,
.input-section input[type="date"]:focus,
.input-section textarea:focus,
.input-section select:focus {
    border-color: #007bff;
    outline: none;
}

.input-section textarea {
    resize: vertical;
    min-height: 80px;
}

.input-section input[type="file"] {
    margin-bottom: 20px;
    padding: 8px 0; /* Dosya seçme butonu için boşluk */
}

/* Buton Stilleri */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

button {
    background-color: #007bff;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    flex: 1;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #0056b3;
}

.secondary-button {
    background-color: #6c757d;
}

.secondary-button:hover {
    background-color: #5a6268;
}

#printCertificate {
    background-color: #28a745;
    margin-top: 15px;
    width: 100%;
}

#printCertificate:hover {
    background-color: #218838;
}

/* Kaydedilen Belgeler Listesi (Bu kısım index.html ve script.js'ten kaldırıldığı için aslında görünmez ama CSS'te kalmasında sakınca yok) */
.saved-certificates {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.saved-certificates h3 {
    margin-top: 0;
    color: #2c3e50;
}

#certificateList {
    list-style: none;
    padding: 0;
}

#certificateList li {
    background-color: #e9ecef;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
}

#certificateList li span {
    font-weight: bold;
    color: #007bff;
}

#certificateList li button {
    background-color: #dc3545;
    color: white;
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.3s;
    width: auto;
    flex: none;
}

#certificateList li button:hover {
    background-color: #c82333;
}


/* Belge Önizleme ve Şablon Stilleri */
.certificate-preview {
    margin-top: 30px;
    border: 2px dashed #ccc;
    padding: 10px;
    background-color: #fdfdfd;
    border-radius: 10px;
    display: none;
    overflow: hidden;
    box-sizing: border-box;
}

.certificate-template {
    width: 210mm; /* A4 genişliği */
    height: 297mm; /* A4 yüksekliği */
    margin: 20px auto;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    background-color: #ffffff;
    padding: 40mm 20mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    position: relative;
    font-family: 'Roboto', sans-serif;
    color: #333;
    line-height: 1.6;

    /* MÜZİK ÇERÇEVESİ İÇİN KOD */
    background-image: url('./images/muzik_cercevesi.png'); /* Resminizin doğru yolunu buraya ekleyin */
    background-size: 100% 100%; /* Çerçeve resmini tüm alanı kaplayacak şekilde ayarla */
    background-repeat: no-repeat;
    background-position: center center;
    border: none; /* Önceki düz çerçeveyi kaldır */
}

/* Belge İçindeki Başlık */
.certificate-template h2 {
    font-family: 'Playfair Display', serif;
    color: #0056b3;
    font-size: 3.5em;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 3px solid #f0f0f0;
    padding-bottom: 10px;
}

/* Okul Logosu */
.school-logo {
    position: absolute;
    top: 25mm;
    left: 20mm;
    width: 150px;
    height: 150px;
    object-fit: contain;
}

/* Okul Adı (üstte) */
.school-name-top {
    font-size: 1.4em;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 20px;
    text-transform: uppercase;
}

/* Öğrenci Resmi */
#previewImage {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #007bff;
    margin-bottom: 25px;
    object-fit: cover;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Belge İçeriği Metni */
.certificate-content {
    font-size: 1.2em;
    line-height: 1.8;
    margin-top: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

.certificate-content p {
    margin-bottom: 15px;
}

.certificate-content strong {
    color: #0056b3;
}

/* İmza ve Tarih Alanları */
.signature-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Sağa hizala */
    padding-right: 20mm; /* Belge boşluğuna göre */
    box-sizing: border-box;
}

.teacher-signature {
    margin-top: 50px;
    font-weight: bold;
    font-style: italic;
    color: #555;
}

.date-display {
    margin-top: 15px;
    font-style: italic;
    color: #777;
}

/* Yazdırma Ayarları - Yatay Sayfa Yönü İçin Güncellendi */
@media print {
    body * {
        visibility: hidden;
    }
    .certificate-preview, .certificate-preview * {
        visibility: visible;
    }
    .certificate-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        border: none;
        box-shadow: none;
        padding: 0;
    }
    .certificate-template {
        margin: 0;
        width: 100%;
        height: 100vh;
        border: none;
        box-shadow: none;
        padding: 40mm 20mm;
    }
    button, .input-section, h1, .button-group, .saved-certificates, .footer { /* Footer'ı yazdırmada gizle */
        display: none;
    }

    @page {
        size: A4 landscape; /* A4 boyutunda yatay yazdırma */
        margin: 0; /* Sayfa kenar boşluklarını sıfırla */
    }

    /* Belgenin içeriğini sayfaya sığdırmak için */
    html, body {
        width: 297mm; /* A4 yatay genişliği */
        height: 210mm; /* A4 yatay yüksekliği */
        overflow: hidden;
    }

    .certificate-preview {
        width: 297mm;
        height: 210mm;
        display: block !important;
    }

    .certificate-template {
        width: 297mm;
        height: 210mm;
        padding: 20mm 30mm; /* Yatay düzende daha uygun padding */
        box-sizing: border-box;
        font-size: 0.9em;

        /* MÜZİK ÇERÇEVESİ İÇİN YAZDIRMA AYARLARI */
        background-image: url('/muzik-belge-olusturucu/images/muzik_cercevesi.png'); /* Resminizin doğru yolunu buraya ekleyin */
        background-size: 100% 100%;
        background-repeat: no-repeat;
        background-position: center center;
        border: none;

        /* YAZDIRMADA ARKA PLAN RESMİNİ GÖSTERMEK İÇİN */
        -webkit-print-color-adjust: exact; /* Chrome, Safari vb. için */
        print-color-adjust: exact; /* Standart */
    }

    .certificate-template h2 {
        font-size: 2.8em;
    }

    .school-logo {
        top: 15mm;
        left: 15mm;
        width: 150px;
        height: 150px;
    }

    #previewImage {
        width: 100px;
        height: 100px;
        margin-bottom: 15px;
    }

    .certificate-content {
        font-size: 1em;
        line-height: 1.5;
    }

    .teacher-signature, .date-display {
        padding-right: 30mm;
    }
}

/* Footer Stili - Bu kısım en altta ve ortada sabit duracak */
.footer {
    position: fixed; /* Ekran penceresine göre sabitlenir */
    bottom: 10px; /* Alttan 10 piksel boşluk */
    left: 50%; /* Sol kenardan %50 konum */
    transform: translateX(-50%); /* Kendi genişliğinin %50'si kadar sola kaydırarak ortala */
    text-align: center; /* Metni ortala */
    font-size: 0.9em; /* Yazı boyutunu biraz küçült */
    width: auto; /* İçeriğine göre genişlik */
    white-space: nowrap; /* Metnin tek satırda kalmasını sağlar */
    z-index: 1000; /* Diğer elementlerin üzerinde görünmesini sağlar */
    color: #555; /* Footer metin rengi */
    padding: 5px 10px; /* Footer'a hafif bir padding ver */
    background-color: rgba(255, 255, 255, 0.9); /* Hafif şeffaf beyaz arka plan */
    border-radius: 5px; /* Hafif yuvarlatılmış köşeler */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Hafif gölge */
    box-sizing: border-box;
    max-width: 90%; /* Çok geniş ekranlarda aşırı yayılmasını engelle */
}

.footer a {
    text-decoration: none; /* Linkin altını çizme */
    color: #007bff; /* Link rengini ayarla */
    font-weight: bold;
    margin: 0 5px; /* Link etrafına boşluk ekle */
}

.footer a:hover {
    text-decoration: underline; /* Mouse üzerine gelince altını çiz */
}