:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #f3f4f6;
    --text: #111827;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --bg-light: #f9fafb;
    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --page-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== MAIN TOOL CONTAINER ===== */
.containert {
    max-width: 1100px;
    margin: 30px auto 40px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

/* ===== HEADER TITLE SECTION ===== */
.header-t {
    padding: 40px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    background-color: transparent;
}

.header-t h1 {
    font-size: 42px;
    margin-bottom: 16px;
    font-weight: 700;
    line-height: 1.4;
    font-family: "Noto Sans", sans-serif;
    color: #1a237e;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.header-t p {
    opacity: 0.9;
    font-size: 18px;
    font-family: "Work Sans", sans-serif;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
    padding: 30px;
}

/* ===== UPLOAD SECTION ===== */
.upload-section {
    text-align: center;
    padding: 60px 40px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background-color: var(--bg-light);
    transition: all 0.3s ease;
    margin-bottom: 30px;
    position: relative;
    cursor: pointer;
}

.upload-section:hover {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.03);
}

.upload-section.active {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.05);
}

.upload-section.drag-over {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.1);
}

.upload-icon {
    font-size: 64px;
    color: var(--primary);
    margin-bottom: 20px;
    opacity: 0.9;
}

.upload-text {
    font-size: 24px;
    color: var(--text);
    margin-bottom: 10px;
    font-weight: 600;
}

.upload-hint {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 30px;
    line-height: 1.5;
}

/* ===== UPLOAD BUTTON ===== */
.btn-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    border: 0;
    outline: 0;
    font-size: 16px;
    gap: 12px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
    position: relative;
    overflow: hidden;
    min-width: 180px;
}

.btn-upload::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.btn-upload:hover {
    background: linear-gradient(135deg, var(--primary-hover), #4f46e5);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.btn-upload:hover::before {
    left: 100%;
}

.btn-upload i {
    font-size: 18px;
}

#pdf-upload {
    display: none;
}

/* Fix for file input coverage */
.btn-upload {
    position: relative;
    overflow: visible;
}

.btn-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* ===== WATERMARK PREVIEW SECTION ===== */
.preview-section,
.options-section,
.action-buttons,
#loadingIndicator {
    display: none;
    margin-bottom: 30px;
}

/* Section visibility controls */
.preview-section.visible,
.options-section.visible {
    display: block;
}

.action-buttons.visible {
    display: flex;
}

.preview-section h3,
.options-section h3 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 20px;
    font-weight: 600;
}

.preview-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pdf-preview,
.watermark-preview {
    flex: 1;
    min-width: 300px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background-color: var(--bg-light);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.pdf-preview:hover,
.watermark-preview:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.preview-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-label {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

/* ===== OPTIONS SECTION ===== */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.option-group {
    margin-bottom: 20px;
}

.option-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
    font-size: 15px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

select.form-control {
    cursor: pointer;
}

/* Range input styling */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="color"] {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.color-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

#textColorHex {
    font-size: 14px;
    color: var(--text-light);
    font-family: monospace;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-light);
}

/* ===== POSITION OPTIONS ===== */
.position-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.position-option {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    background: white;
}

.position-option:hover {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.1);
}

.position-option.active,
.position-option.selected {
    border-color: var(--primary);
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

/* ===== IMAGE UPLOAD ===== */
.image-upload-container {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    background-color: var(--bg-light);
}

.image-upload-container:hover {
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.05);
}

.image-upload-container i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 10px;
    display: block;
}

.image-upload-container p {
    margin: 5px 0;
    color: var(--text);
}

.image-upload-container .upload-hint {
    margin: 5px 0;
    font-size: 14px;
}

.image-preview {
    max-width: 100%;
    max-height: 120px;
    margin-top: 15px;
    display: none;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: none;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 32px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 0;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    transform: translateY(-2px);
}

/* Disabled button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ===== LOADING INDICATOR ===== */
.loading {
    display: none;
    margin: 30px 0;
    text-align: center;
    color: var(--primary);
    font-size: 16px;
    font-weight: 500;
    padding: 20px;
}

.loading.visible {
    display: block;
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 12px;
    font-size: 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0); }
    100% { transform: rotate(360deg); }
}

/* ===== HOW-TO SECTION ===== */
.how-to-section-wrapper {
    max-width: 1100px;
    margin: 4rem auto;
    padding: 0 20px;
}

.how-to-section-wrapper h2 {
    font-family: 'Noto Sans', sans-serif;
    text-align: center;
    font-size: 2.2rem;
    color: #333;
    line-height: 1.6;
    margin-bottom: 40px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.step-card {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    text-align: left;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.step-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.step-card .step-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    background-color: #0d47a1;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.step-card h3 {
    font-family: 'Noto Sans', sans-serif;
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #222;
}

.step-card p {
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
    margin: 0;
}

/* ===== VALUABLE CONTENT ===== */
.valuable-content {
    max-width: 1100px;
    margin: 60px auto;
    padding: 40px 20px;
    background-color: #f8f9fa;
    line-height: 1.7;
    color: #333;
    font-family: 'Arial', sans-serif;
    box-sizing: border-box;
}

.valuable-content h2 {
    font-size: 2.4rem;
    font-weight: 700;
    color: #1a237e;
    margin-top: 0;
    margin-bottom: 30px;
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
}

.valuable-content h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1a237e;
    margin-top: 40px;
    margin-bottom: 20px;
    line-height: 1.4;
}

.valuable-content p {
    color: #4b5563;
    font-size: 1.05rem;
    margin-bottom: 20px;
    line-height: 1.7;
    max-width: 100%;
    text-align: left;
}

.valuable-content ul {
    list-style: none;
    padding-left: 25px;
    margin: 1.5rem 0 2rem 0;
}

.valuable-content ul li {
    position: relative;
    margin-bottom: 1rem;
    line-height: 1.7;
    font-size: 1.05rem;
    color: #4b5563;
}

.valuable-content ul li::before {
    content: '\f058';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #10b981;
    position: absolute;
    left: -25px;
    top: 4px;
    font-size: 1rem;
}

.valuable-content strong {
    color: #374151;
}

.valuable-content a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.valuable-content a:hover {
    color: #4338ca;
    text-decoration: underline;
}

/* Remove any text-alignment constraints */
.valuable-content * {
    max-width: none !important;
}

/* ===== CONTENT SECTIONS (for FAQ format) ===== */
.content-section-wrapper {
    padding: 80px 20px;
    font-family: 'Open Sans', sans-serif;
    background-color: #f8f9fa;
}

.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    text-align: center;
    font-size: 2.8rem;
    color: #1a237e;
    line-height: 1.3;
    margin-bottom: 60px;
    font-weight: 700;
}

.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Noto Sans', sans-serif;
    line-height: 1.7;
    color: #333;
}

.content-wrapper h3 {
    font-size: 1.5rem;
    color: #1a237e;
    margin-top: 40px;
    margin-bottom: 15px;
    font-weight: 700;
    line-height: 1.4;
    position: relative;
    padding-left: 24px;
}

.content-wrapper h3:first-child {
    margin-top: 0;
}

.content-wrapper h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-color: #4f46e5;
    border-radius: 50%;
}

.content-wrapper p {
    margin-bottom: 25px;
    font-size: 17px;
    color: #4b5563;
    line-height: 1.7;
    padding-left: 24px;
}

.content-wrapper h3 + p {
    margin-top: -5px;
}

/* ===== FAQ SECTION (old toggle style) ===== */
.faq-container {
    border-top: 2px solid #ddd;
    padding-top: 30px;
    margin-top: 40px;
    text-align: center;
}

.faq-container h2 {
    font-size: 2.2rem;
    color: #4f46e5;
    margin-bottom: 30px;
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
}

.faq-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    text-align: left;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.faq-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
}

.faq-question:hover {
    background-color: #f5f5f5;
}

.faq-question i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 20px;
}

.faq-answer p {
    padding-bottom: 20px;
    margin: 0;
    font-size: 1rem;
    color: #555;
    text-align: left;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 1024px) {
    .containert,
    .valuable-content,
    .how-to-section-wrapper,
    .content-container {
        max-width: 95%;
    }
    
    .section-title {
        font-size: 2.4rem;
    }
    
    .content-wrapper,
    .faq-item {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .containert {
        max-width: 100%;
        margin: 20px auto;
        border-radius: 12px;
    }
    
    .header-t {
        padding: 30px 15px;
    }
    
    .header-t h1 {
        font-size: 32px;
    }
    
    .header-t p {
        font-size: 16px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .upload-section {
        padding: 40px 20px;
    }
    
    .upload-text {
        font-size: 20px;
    }
    
    .upload-icon {
        font-size: 48px;
    }
    
    .preview-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .pdf-preview,
    .watermark-preview {
        min-width: 100%;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .position-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn {
        width: 100%;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .step-card {
        padding: 25px;
    }
    
    .valuable-content {
        padding: 30px 15px;
        margin: 40px auto;
    }
    
    .valuable-content h2 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    
    .valuable-content h3 {
        font-size: 1.4rem;
        margin-top: 25px;
    }
    
    .valuable-content p,
    .valuable-content ul li {
        font-size: .95rem;
    }
    
    .content-section-wrapper {
        padding: 60px 15px;
    }
    
    .section-title {
        font-size: 2rem;
        margin-bottom: 40px;
    }
    
    .content-wrapper {
        max-width: 95%;
    }
    
    .content-wrapper h3 {
        font-size: 1.3rem;
        margin-top: 35px;
        margin-bottom: 12px;
        padding-left: 20px;
    }
    
    .content-wrapper h3::before {
        width: 10px;
        height: 10px;
    }
    
    .content-wrapper p {
        font-size: 16px;
        padding-left: 20px;
    }
    
    .faq-container h2 {
        font-size: 1.8rem;
    }
    
    .faq-question {
        font-size: 1rem;
        padding: 15px 18px;
    }
    
    .faq-answer p {
        font-size: .95rem;
    }
    
    .faq-item {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .containert {
        max-width: 100%;
        margin: 0 auto 20px;
        border-radius: 0;
    }
    
    .header-t {
        padding: 30px 15px;
    }
    
    .header-t h1 {
        font-size: 28px;
    }
    
    .header-t p {
        font-size: 15px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .upload-section {
        padding: 30px 15px;
    }
    
    .upload-text {
        font-size: 18px;
    }
    
    .btn-upload {
        width: 100%;
        padding: 12px 20px;
    }
    
    .position-grid {
        grid-template-columns: 1fr;
    }
    
    .steps-grid {
        gap: 15px;
    }
    
    .step-card {
        padding: 20px;
    }
    
    .valuable-content {
        padding: 25px 12px;
        margin: 30px auto;
    }
    
    .valuable-content h2 {
        font-size: 1.6rem;
    }
    
    .valuable-content h3 {
        font-size: 1.3rem;
    }
    
    .valuable-content ul {
        padding-left: 20px;
    }
    
    .valuable-content ul li::before {
        left: -20px;
    }
    
    .content-section-wrapper {
        padding: 50px 10px;
    }
    
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }
    
    .content-wrapper h3 {
        font-size: 1.2rem;
        margin-top: 30px;
        padding-left: 18px;
    }
    
    .content-wrapper h3::before {
        width: 8px;
        height: 8px;
    }
    
    .content-wrapper p {
        font-size: 15px;
        padding-left: 18px;
        margin-bottom: 20px;
    }
    
    .faq-container h2 {
        font-size: 1.6rem;
    }
    
    .faq-question {
        font-size: 0.95rem;
        padding: 15px;
    }
    
    .faq-answer p {
        font-size: 0.9rem;
    }
    
    .faq-item {
        max-width: 100%;
    }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex {
    display: flex !important;
}

.grid {
    display: grid !important;
}

.text-center {
    text-align: center;
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}