/*
==================================================================
DESIGN SYSTEM & GENERAL STYLES
==================================================================
*/
:root {
    --primary-red: #e5322d;
    --primary-red-dark: #c22a25;
    --secondary-dark: #333;
    --text-light: #666;
    --background-light: #f8f8fa;
    --background-white: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    color: var(--secondary-dark);
    background-color: var(--background-white);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    line-height: 1.2;
    font-weight: 600;
}

h1 { font-size: 3rem; }
h2 { font-size: 2.2rem; margin-bottom: 2rem; text-align: center; }
h3 { font-size: 1.5rem; }

section {
    padding: 80px 0;
}

/* Reveal Animation */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/*
==================================================================
HEADER & NAVIGATION
==================================================================
*/
.header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--background-white);
    z-index: 1000;
    transition: box-shadow 0.3s ease;
}

.header.scrolled {
    box-shadow: var(--shadow);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-red);
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: var(--secondary-dark);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary-red);
}

.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.hamburger .bar {
    width: 25px;
    height: 3px;
    background-color: var(--secondary-dark);
    transition: all 0.3s ease;
}

.hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.active .bar:nth-child(2) { opacity: 0; }
.hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Mobile Nav */
.mobile-nav {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background-color: var(--background-white);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    list-style: none;
    gap: 40px;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 999;
}

.mobile-nav.active {
    transform: translateX(0);
}

.mobile-nav a {
    font-size: 1.8rem;
    text-decoration: none;
    color: var(--secondary-dark);
}

/*
==================================================================
HERO SECTION
==================================================================
*/
.hero {
    text-align: center;
    padding: 100px 0;
    background: linear-gradient(180deg, var(--background-white) 0%, var(--background-light) 100%);
}

.hero h1 {
    color: var(--secondary-dark);
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/*
==================================================================
ADVERTISEMENT PLACEHOLDERS
==================================================================
*/
.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    border: 2px dashed #ccc;
    color: #999;
    font-size: 1rem;
    text-align: center;
}
.ad-placeholder-top {
    width: 728px;
    height: 90px;
    margin: 0 auto 60px;
}
.ad-placeholder-sidebar {
    width: 160px;
    height: 400px;
    margin-left: 20px;
    flex-shrink: 0;
}

/*
==================================================================
TOOLS GRID SECTION
==================================================================
*/
#tools {
    background-color: var(--background-light);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.tool-card {
    background-color: var(--background-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--primary-red);
}

.tool-card .icon {
    color: var(--primary-red);
    margin-bottom: 15px;
    height: 48px;
    width: 48px;
    display: inline-block;
}

.tool-card .icon svg {
    width: 100%;
    height: 100%;
}

.tool-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--secondary-dark);
}

.tool-card p {
    font-size: 0.9rem;
    color: var(--text-light);
}

.badge {
    position: absolute;
    top: 10px;
    right: -30px;
    background-color: var(--primary-red);
    color: white;
    padding: 2px 30px;
    font-size: 0.8rem;
    font-weight: bold;
    transform: rotate(45deg);
}

/*
==================================================================
ARTICLE / ABOUT SECTION
==================================================================
*/
#about .container {
    max-width: 800px;
}
#about h2, #about h3 {
    text-align: left;
}
#about h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}
#about p, #about li {
    color: var(--text-light);
    margin-bottom: 1rem;
}
#about ul {
    padding-left: 20px;
}

/*
==================================================================
MODAL
==================================================================
*/
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--background-white);
    margin: 5% auto;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

#modal-title { margin-bottom: 0; }

.close-button {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: var(--secondary-dark);
}

.modal-body {
    padding: 20px;
    display: flex;
}

.modal-main {
    flex-grow: 1;
}

#drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
}
#drop-zone.dragover {
    border-color: var(--primary-red);
    background-color: #fdeeee;
}
#drop-zone p {
    margin: 0;
    color: var(--text-light);
}
#drop-zone .upload-icon { 
    font-size: 2rem;
    color: var(--primary-red); 
    display: inline-block;
    width: 32px;
    height: 32px;
}
#drop-zone .upload-icon svg {
     width: 100%;
     height: 100%;
}

#file-list { margin-top: 20px; }
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: var(--background-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 5px;
}
.remove-file {
    cursor: pointer;
    color: var(--primary-red);
    font-weight: bold;
}

#tool-options { margin-top: 20px; }
#tool-options label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
#tool-options input, #tool-options select, #tool-options textarea {
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
}

#process-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: var(--primary-red);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}
#process-btn:hover {
    background-color: var(--primary-red-dark);
}
#process-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#output-area { margin-top: 20px; }
.download-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
}

/* Loader */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loader {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 2001;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    border-radius: 8px;
}
.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--primary-red);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}
#loader p {
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--secondary-dark);
}

#pdf-edit-canvas-container {
    border: 1px solid #ccc;
    margin-top: 10px;
    position: relative;
    max-width: 100%;
    overflow: auto;
}
#pdf-viewer-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
#signature-pad {
    border: 1px solid var(--border-color);
}

/*
==================================================================
FOOTER
==================================================================
*/
.footer {
    background-color: var(--secondary-dark);
    color: #ccc;
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.footer-col p, .footer-col a {
    color: #ccc;
    text-decoration: none;
    margin-bottom: 10px;
    display: block;
    transition: color 0.3s ease;
}

.footer-col a:hover {
    color: var(--primary-red);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #444;
    font-size: 0.9rem;
}

.footer-bottom p {
    margin: 0;
}

/*
==================================================================
RESPONSIVE DESIGN
==================================================================
*/
@media (max-width: 992px) {
    .tools-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .ad-placeholder-sidebar { display: none; }
}

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.8rem; }
    section { padding: 60px 0; }
    
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .ad-placeholder-top { width: 90%; max-width: 468px; height: 60px; }
    .modal-content {
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 2rem; }
    .tools-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .modal-body { flex-direction: column; }
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }
    .modal-body {
        overflow-y: auto;
        flex-grow: 1;
    }
    #drop-zone { padding: 20px; }
}