: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;
}

@media (max-width: 768px) {
    .containert {
        max-width: 95%;
        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 ===== */
.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;
}

.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-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;
}

/* ===== PAGES GRID ===== */
.pages-container {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin: 30px 0;
}

.page-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--page-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.page-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.page-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-number {
    background-color: white;
    color: var(--primary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.page-content {
    padding: 20px;
    background-color: white;
}

.page-canvas {
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    background-color: white;
    margin-bottom: 20px;
    border-radius: 8px;
}

.margin-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.margin-group {
    display: flex;
    flex-direction: column;
}

.margin-label {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 500;
}

.margin-input {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    width: 100%;
    transition: all 0.2s ease;
}

.margin-input:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ===== 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);
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
    transform: translateY(-2px);
}

/* ===== GLOBAL ACTIONS ===== */
.global-actions {
    display: none;
    justify-content: space-between;
    margin-bottom: 24px;
    align-items: center;
    background: var(--bg-light);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.global-margin-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.apply-all-btn {
    background-color: var(--success);
    color: white;
    border: 0;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-width: 180px;
}

.apply-all-btn:hover {
    background-color: #0da271;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* ===== LOADING INDICATOR ===== */
.loading {
    display: none;
    margin: 30px 0;
    text-align: center;
    color: var(--primary);
    font-size: 16px;
    font-weight: 500;
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    0% { transform: rotate(0); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== CONTENT SECTIONS ===== */
.content-section-wrapper {
    padding: 80px 20px;
    font-family: 'Open Sans', sans-serif;
}

.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;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.info-card {
    background-color: #fff;
    padding: 40px 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    height: 100%;
}

.info-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.info-card-icon {
    font-size: 2.8rem;
    color: var(--primary);
    width: 80px;
    height: 80px;
    margin: 0 auto 25px auto;
    border-radius: 50%;
    background-color: rgba(79, 70, 229, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 15px;
    font-weight: 700;
}

.info-card p {
    color: var(--text-light);
    line-height: 1.7;
    font-size: 16px;
}

/* ===== FAQ CONTENT SECTION ===== */
.content-section-wrapper {
    padding: 80px 0;
    background-color: #f8f9fa !important;
    font-family: 'Open Sans', sans-serif;
}

.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;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 1024px) {
    .content-container {
        max-width: 95%;
    }
    
    .section-title {
        font-size: 2.4rem;
    }
    
    .content-wrapper {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .content-section-wrapper {
        padding: 60px 0;
    }
    
    .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;
    }
}

@media (max-width: 480px) {
    .content-section-wrapper {
        padding: 50px 0;
    }
    
    .content-container {
        padding: 0 15px;
    }
    
    .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;
    }
}

/* ===== ENHANCEMENTS ===== */
.content-wrapper h3 {
    transition: color 0.3s ease;
}

.content-wrapper h3:hover {
    color: #4338ca;
}

.content-wrapper p {
    transition: color 0.3s ease;
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .content-wrapper h3,
    .content-wrapper p {
        transition: none;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .content-section-wrapper {
        background-color: transparent !important;
        padding: 40px 0;
    }
    
    .content-wrapper h3 {
        color: #000;
        page-break-inside: avoid;
    }
    
    .content-wrapper p {
        color: #000;
        page-break-inside: avoid;
    }
}

/* ===== CONTENT WRAPPER - FIXED TEXT FLOW ===== */
.content-wrapper {
    max-width: 1100px;
    margin: 60px auto;
    padding: 0 20px;
    font-family: 'Noto Sans', sans-serif;
    line-height: 1.7;
    color: var(--text);
}

.content-wrapper h2 {
    font-size: 2.4rem;
    color: #1a237e;
    margin-top: 60px;
    margin-bottom: 25px;
    border-bottom: none;
    padding-bottom: 0;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
}

.content-wrapper h3 {
    font-size: 1.8rem;
    color: var(--text);
    margin-top: 40px;
    margin-bottom: 20px;
    font-weight: 600;
}

.content-wrapper p {
    margin-bottom: 25px;
    font-size: 17px;
    color: var(--text);
    max-width: 100%;
    text-align: left;
    line-height: 1.7;
}

.content-wrapper ul {
    list-style: none;
    padding: 0;
    margin-bottom: 30px;
    max-width: 100%;
}

.content-wrapper ul li {
    position: relative;
    padding-left: 40px;
    margin-bottom: 20px;
    font-size: 17px;
    line-height: 1.7;
    color: var(--text);
}

.content-wrapper ul li i {
    position: absolute;
    left: 0;
    top: 4px;
    color: var(--success);
    font-size: 1.3em;
}

.content-wrapper a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.content-wrapper a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 1024px) {
    .containert {
        max-width: 95%;
    }
    
    .content-wrapper {
        max-width: 95%;
        margin: 40px auto;
    }
    
    .section-title {
        font-size: 2.4rem;
    }
    
    .grid-3 {
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .pages-container {
        grid-template-columns: 1fr;
    }
    
    .margin-controls {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn {
        width: 100%;
    }
    
    .global-actions {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .global-margin-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .section-title {
        font-size: 2rem;
        margin-bottom: 40px;
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .info-card {
        padding: 30px 20px;
    }
    
    .info-card-icon {
        width: 70px;
        height: 70px;
        font-size: 2.2rem;
    }
    
    .content-section-wrapper {
        padding: 60px 15px;
    }
    
    .content-wrapper h2 {
        font-size: 1.8rem;
        margin-top: 40px;
        margin-bottom: 20px;
    }
    
    .content-wrapper h3 {
        font-size: 1.5rem;
    }
    
    .content-wrapper p,
    .content-wrapper ul li {
        font-size: 16px;
    }
    
    .upload-section {
        padding: 40px 20px;
    }
    
    .upload-icon {
        font-size: 48px;
    }
    
    .upload-text {
        font-size: 20px;
    }
    
    .faq-question,
    .faq-answer {
        padding: 20px;
    }
    
    .faq-question {
        font-size: 1.1rem;
    }
}

@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;
    }
    
    .content-wrapper {
        padding: 0 15px;
        margin: 30px auto;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .faq-question {
        font-size: 1rem;
        padding: 15px;
    }
    
    .faq-answer {
        padding: 15px;
        font-size: 15px;
    }
}

/* ===== 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;
}