/* --- Global & Shared Styles --- */
:root {
    --primary-color-site: #0a4d68;
    --secondary-color-site: #088395;
    --light-color-site: #f8f9fa;
    --dark-color-site: #343a40;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #f0f2f5;
    color: #333;
}

body.menu-open {
    overflow: hidden;
}

#overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

#overlay.active {
    display: block;
}

/* --- Header & Navigation --- */
.header {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.3s ease;
}

.header .container-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 65px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo img { height: 45px; }
.logo span { font-size: 1.5rem; font-weight: 700; color: var(--primary-color-site); transition: color 0.3s ease; }
.primary-menu .nav-links { list-style: none; display: flex; align-items: center; gap: 1.5rem; }
.primary-menu a { text-decoration: none; color: var(--dark-color-site); font-weight: 500; transition: color 0.3s ease; }
.primary-menu a:hover { color: var(--secondary-color-site); }
.dropdown { position: relative; }
.dropdown-content { display: none; position: absolute; background-color: #fff; min-width: 260px; box-shadow: var(--box-shadow); z-index: 1; border-radius: 8px; padding: 0.5rem 0; margin-top: 10px; border: 1px solid #eee; }
.dropdown-content a { color: var(--dark-color-site); padding: 12px 20px; display: block; font-size: 0.95rem; }
.dropdown-content a:hover { background-color: var(--light-color-site); }
.dropdown:hover .dropdown-content { display: block; }
.dropdown .dropbtn i { font-size: 0.7rem; margin-left: 5px; transition: transform 0.3s ease; }
.dropdown:hover .dropbtn i { transform: rotate(180deg); }
.mobile-menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--primary-color-site); cursor: pointer; z-index: 1001; }

/* --- Pad Generator Styles --- */
.app-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    padding: 40px 20px;
}
.controls { background-color: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); width: 320px; flex-shrink: 0; }
.controls h2 { margin-top: 0; font-size: 22px; color: #1a2a3a; border-bottom: 2px solid #f0f2f5; padding-bottom: 10px; margin-bottom: 10px; }
.controls p { font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.controls label { display: block; font-weight: 600; font-size: 14px; margin-top: 15px; margin-bottom: 5px; }
.controls input { width: 100%; padding: 10px; font-size: 14px; font-family: 'Montserrat', sans-serif; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }

.logo-upload-container { margin-top: 15px; }
.logo-upload-container label { margin-bottom: 10px; }
.logo-upload-container .secondary-btn { width: 100%; padding: 10px; font-family: 'Montserrat', sans-serif; font-size: 14px; font-weight: 600; background-color: #6c757d; color: white; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s ease; display: block; text-align: center; }
.logo-upload-container .secondary-btn.remove { background-color: #dc3545; margin-top: 10px; }
.logo-upload-container .secondary-btn:hover { background-color: #5a6268; }
.logo-upload-container .secondary-btn.remove:hover { background-color: #c82333; }


#a4-page-wrapper {
    width: 210mm;
    flex-shrink: 0;
}
#a4-page {
    width: 100%;
    height: 297mm;
    background-color: #ffffff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 20mm 15mm;
}

.pad-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #1a2a3a; padding-bottom: 10px; flex-shrink: 0; }
.logo-area { display: flex; align-items: center; }
.company-name h1 { font-size: 24px; font-weight: 700; color: #1a2a3a; margin: 0; }
.company-name p { font-size: 12px; font-weight: 400; color: #555; margin: 5px 0 0; }
.contact-info { display: flex; flex-direction: column; align-items: flex-end; font-size: 11px; }
.contact-info span { margin-top: 5px; word-break: break-all; }
.contact-info i { color: #007bff; margin-right: 8px; width: 12px; }

.logo-circle { display: flex; align-items: center; justify-content: center; background-color: #007bff; border-radius: 50%; color: white; font-weight: 700; flex-shrink: 0; background-size: contain; background-position: center; background-repeat: no-repeat; }
.logo-circle.image-mode { background-color: transparent; }
#header-logo { width: 50px; height: 50px; font-size: 28px; margin-right: 15px; }
.pad-body { flex-grow: 1; position: relative; }
.watermark { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0.08; font-size: 200px; width: 250px; height: 250px; z-index: 0; pointer-events: none; }
.pad-footer { flex-shrink: 0; padding-top: 10px; }
.footer-line { height: 3px; background-color: #007bff; width: 40px; border-radius: 2px; }

#generate-png { width: 100%; margin-top: 25px; padding: 12px 25px; font-family: 'Montserrat', sans-serif; font-size: 16px; font-weight: 600; background-color: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s ease; }
#generate-png:hover { background-color: #0056b3; }

/* --- Site-wide Footer Styles --- */
.footer { background-color: var(--dark-color-site); color: #ccc; padding: 40px 20px 20px; }
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid #555; max-width: 1200px; margin: 0 auto; }
.footer-logo { font-size: 1.2rem; font-weight: 700; color: #fff; }
.footer-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.footer-menu a { color: #ccc; text-decoration: none; transition: color 0.3s ease; }
.footer-menu a:hover { color: #fff; }
.copyright { text-align: center; margin-top: 20px; font-size: 0.9rem; }

/* --- Responsive & Print Styles --- */

/* For Tablets and smaller laptops - Show mobile menu earlier */
@media (max-width: 992px) {
    .primary-menu { display: none; }
    .mobile-menu-toggle { display: block; }
    .primary-menu.mobile-active { display: flex; position: fixed; top: 0; right: 0; width: min(80vw, 320px); height: 100vh; background-color: #fff; z-index: 999; transform: translateX(100%); transition: transform 0.3s ease-in-out; flex-direction: column; align-items: flex-start; gap: 0; padding: 2rem; }
    .primary-menu.mobile-active.active { transform: translateX(0); }
    .primary-menu.mobile-active li { width: 100%; }
    .primary-menu.mobile-active a { padding: 1rem 0; display: block; width: 100%; }
    .dropdown:hover .dropdown-content { display: none; }
    .dropdown-content { position: static; display: none; box-shadow: none; background-color: #f7f7f7; padding-left: 1rem; }
    .dropdown.active > .dropdown-content { display: block; }
    .dropdown.active > a > i { transform: rotate(180deg); }
    .dropdown .dropbtn { display: flex; justify-content: space-between; align-items: center; width: 100%; }

    .app-container { flex-direction: column; align-items: center; }
    .controls { width: 100%; max-width: 600px; order: 1; }
    #a4-page-wrapper { width: 100%; max-width: 600px; order: 2; margin-top: 20px; }
    #a4-page { transform-origin: top left; width: 210mm; transform: scale(calc(100% / 210mm)); height: auto; aspect-ratio: 210 / 297; }
}

/* For phones */
@media (max-width: 767px) {
    .footer-content { flex-direction: column; text-align: center; }
    .footer-menu { justify-content: center; }
    .footer-menu a { display: inline-block; padding: 5px 0; }
}

@media print {
    body { background-color: #fff; padding: 0; }
    .header, .footer, .controls, .app-container > h2, #generate-png { display: none !important; }
    .app-container { display: block; padding: 0; }
    #a4-page-wrapper { width: 100%; max-width: 100%; margin: 0; }
    #a4-page { box-shadow: none; margin: 0; padding: 0; width: 100%; height: 100%; transform: scale(1); aspect-ratio: auto; }
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}