* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

    /* Modern themed stylesheet for PDF Editor */
    :root{
        --bg: #f5f7fa;
        --surface: #ffffff;
        --muted: #6b7280;
        --primary: #1a73e8;
        --primary-600: #0f5fc1;
        --accent: #34a853;
        --danger: #e53935;
        --glass: rgba(255,255,255,0.9);
        --soft-shadow: 0 8px 24px rgba(11,22,45,0.06);
        --btn-radius: 10px;
    }

    * { box-sizing: border-box; }
    html,body{ height:100%; }
    body {
        margin: 0;
        padding: 0;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        background: var(--bg);
        color: #111827;
        line-height: 1.5;
    }

    .container {
        max-width: 1400px;
        margin: 18px auto;
        padding: 20px;
    }

    header{
        background: linear-gradient(135deg, var(--primary), #0d47a1);
        color: white;
        padding: 18px 22px;
        border-radius: 12px;
        margin-bottom: 18px;
        display:flex;
        justify-content:space-between;
        align-items:center;
        box-shadow: var(--soft-shadow);
    }
    header h1{ display:flex; align-items:center; gap:10px; font-size:1.4rem; }

    .file-upload{ display:flex; align-items:center; gap:14px; }
    #fileName{ font-style:italic; opacity:0.9; color: rgba(255,255,255,0.92); }

    /* Button base */
    .btn{
        background: linear-gradient(180deg, rgba(255,255,255,0.98), var(--surface));
        color: var(--primary);
        border: 1px solid rgba(26,115,232,0.08);
        padding: 10px 16px;
        border-radius: var(--btn-radius);
        cursor: pointer;
        font-weight:700;
        display:inline-flex;
        align-items:center;
        gap:10px;
        transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
        box-shadow: 0 6px 18px rgba(11,22,45,0.04);
    }
    .btn:hover{ transform: translateY(-3px); opacity:0.98; box-shadow: 0 14px 40px rgba(11,22,45,0.06); }

    .editor-container{ display:flex; gap:20px; height: calc(100vh - 180px); }

    .sidebar{
        width: 300px;
        background: var(--surface);
        border-radius: 12px;
        padding: 18px;
        box-shadow: var(--soft-shadow);
        overflow-y:auto;
    }
    .sidebar h3{ color:var(--primary); margin-bottom:12px; display:flex; align-items:center; gap:8px; }
    .tool-section{ margin-bottom:18px; padding-bottom:12px; border-bottom:1px solid #f0f3f8; }
    .tool-section h4{ color:var(--muted); margin-bottom:10px; font-size:0.95rem; display:flex; align-items:center; gap:8px; }

    /* Collapsible tool sections */
    .tool-section h4{
        cursor: pointer;
        user-select: none;
        position: relative;
        padding-right: 18px;
    }
    .tool-section h4::after{
        content: '\25BC'; /* down chevron */
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        font-size: 0.8rem;
        color: var(--muted);
        transition: transform .18s ease;
    }
    .tool-section.open h4::after{ transform: translateY(-50%) rotate(180deg); }
    .tool-section .section-body{ transition: max-height .18s ease, opacity .18s ease; overflow: hidden; }
    .tool-section.collapsed .section-body{ max-height: 0; opacity: 0; padding-top: 0; margin-top: 0; }
    .tool-section .section-body{ max-height: 1000px; opacity: 1; }

    /* Tool buttons */
    .tool-btn{
        width:100%;
        padding:10px 12px;
        margin-bottom:10px;
        background: linear-gradient(180deg, #fbfdff, #f6f9fc);
        border: 1px solid rgba(11,22,45,0.06);
        border-radius: calc(var(--btn-radius) - 2px);
        display:flex;
        align-items:center;
        justify-content:flex-start;
        gap:12px;
        color: #0f1724;
        cursor:pointer;
        transition: transform .12s ease, box-shadow .12s ease;
    }
    .tool-btn:hover{ transform: translateY(-3px); box-shadow: 0 12px 30px rgba(11,22,45,0.04); }
    .tool-btn.active{ background: linear-gradient(180deg, var(--primary), var(--primary-600)); color:white; box-shadow: 0 16px 44px rgba(26,115,232,0.12); }
    .tool-btn.delete{ background: linear-gradient(180deg, rgba(255,244,244,1), rgba(255,238,238,1)); color:var(--danger); border-color: rgba(229,57,53,0.08); }

    /* Download button */
    .btn.download{ background: linear-gradient(180deg, var(--accent), #2e8b47); color:white; width:100%; border:none; box-shadow: 0 14px 36px rgba(52,168,83,0.12); }

    .color-picker, .size-picker{ margin-top:8px; }
    .color-picker label, .size-picker label{ display:block; font-size:0.85rem; color:var(--muted); margin-bottom:6px; }
    input[type="color"]{ width:100%; height:34px; border-radius:8px; border:1px solid #e6eef6; cursor:pointer; }
    .size-picker{ display:flex; align-items:center; gap:10px; }
    input[type="range"]{ flex:1; }

    .main-content{ flex:1; display:flex; flex-direction:column; background:var(--surface); border-radius:12px; overflow:hidden; box-shadow: var(--soft-shadow); }
    .pdf-controls{ background: #f8fafc; padding:14px 18px; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid #eef4fb; }
    .page-btn{ padding:8px 14px; background: linear-gradient(180deg, var(--primary), #0d62d9); color:white; border:none; border-radius:8px; cursor:pointer; display:flex; align-items:center; gap:8px; transition: transform .12s ease, box-shadow .12s ease; }
    .page-btn:hover{ transform: translateY(-3px); }
    .page-info{ font-weight:700; color:var(--muted); }
    .zoom-controls{ display:flex; align-items:center; gap:10px; }
    .zoom-btn{ width:40px; height:40px; border-radius:10px; background:var(--surface); border:1px solid rgba(11,22,45,0.04); cursor:pointer; display:flex; align-items:center; justify-content:center; transition: transform .12s ease, box-shadow .12s ease; }
    .zoom-btn:hover{ transform: translateY(-2px); box-shadow: 0 10px 30px rgba(11,22,45,0.04); }

    .pdf-container{ flex:1; position:relative; overflow:auto; background: #f5f7fb; padding:20px; display:flex; justify-content:center; align-items:flex-start; }
    #pdfCanvas{ box-shadow: 0 8px 24px rgba(11,22,45,0.06); background: white; }
    #annotationCanvas{ position:absolute; top:20px; left:50%; transform:translateX(-50%); pointer-events:none; z-index:30; }
    #textContainer{ position:absolute; top:20px; left:50%; transform:translateX(-50%); z-index:40; pointer-events:auto; }

    .text-box{ position:absolute; min-width:120px; min-height:34px; padding:8px; border:2px dashed rgba(26,115,232,0.18); background:var(--glass); resize:both; overflow:auto; cursor:move; outline:none; font-family:Arial, sans-serif; box-shadow: 0 6px 18px rgba(11,22,45,0.04); border-radius:8px; }
    .text-box.selected{ border-color:#ff7a59; box-shadow: 0 12px 30px rgba(255,122,89,0.08); }

    .highlight-box{ position:absolute; background: rgba(255,246,120,0.26); border:1px solid rgba(255,204,0,0.4); pointer-events:auto; border-radius:4px; }
    .image-box{ position:absolute; cursor:move; border-radius:8px; border:1px solid rgba(0,0,0,0.08); background: rgba(255,255,255,0.95); box-shadow: 0 8px 24px rgba(11,22,45,0.04); z-index:50; padding:6px; }
    .shape-box{ position:absolute; pointer-events:auto; z-index:45; border-radius:6px; }

    @media (max-width: 1024px){
        .editor-container{ flex-direction:column; height:auto; }
        .sidebar{ width:100%; }
    }

.btn.download:hover {
    background-color: #2e8b47;
}

.color-picker, .size-picker {
    margin-top: 10px;
}

.color-picker label, .size-picker label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

input[type="color"] {
    width: 100%;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.size-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="range"] {
    flex-grow: 1;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pdf-controls {
    background-color: #f8f9fa;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.page-btn {
    padding: 8px 15px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s;
}

.page-btn:hover {
    background-color: #0d62d9;
}

.page-info {
    font-weight: 600;
    color: #555;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: white;
    border: 1px solid #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background-color: #f0f7ff;
    border-color: #1a73e8;
}

.pdf-container {
    flex-grow: 1;
    position: relative;
    overflow: auto;
    background-color: #f5f5f5;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#pdfCanvas {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: white;
}

#annotationCanvas {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

#textContainer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.text-box {
    position: absolute;
    min-width: 100px;
    min-height: 30px;
    padding: 5px;
    border: 2px dashed #1a73e8;
    background-color: rgba(255, 255, 255, 0.9);
    resize: both;
    overflow: hidden;
    cursor: move;
    outline: none;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.text-box.selected {
    border: 2px solid #ff5722;
}

.highlight-box {
    position: absolute;
    background-color: rgba(255, 255, 0, 0.3);
    border: 1px solid rgba(255, 204, 0, 0.5);
    pointer-events: none;
}

.image-box {
    position: absolute;
    cursor: move;
    border: 1px solid rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 120;
}

.shape-box {
    position: absolute;
    pointer-events: auto;
    z-index: 60;
}

@media (max-width: 1024px) {
    .editor-container {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
    }
}
