/* ============================================
   Paper Generator CSS
   ============================================ */

.pg-hero {
    padding: 20px 0 12px;
    text-align: center;
}

.pg-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.pg-hero p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pg-workspace {
    padding: 0 0 80px;
}

/* Two-Panel Layout */
.pg-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 28px;
    align-items: start;
}

/* Controls Panel */
.pg-controls {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    padding: 16px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
}

.pg-export-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.pg-export-bar .btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.85rem;
}

/* Logo Drop Area */
.logo-drop-area {
    border: 2px dashed rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: rgba(99, 102, 241, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-drop-area:hover,
.logo-drop-area.dragover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.06);
    transform: scale(1.01);
}

/* Drag Hint */
.pg-drag-hint {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    font-size: 0.8rem;
    color: #6366f1;
    text-align: center;
    animation: dragHintPulse 2s ease-in-out infinite;
}

@keyframes dragHintPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Accordion Panels */
.pg-panel {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--bg-secondary, #f9fafb);
    border-left: 3px solid #6366f1;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.pg-panel:hover {
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.08);
}

.pg-panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 16px;
    margin: 0;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
    transition: background 0.15s;
    background: linear-gradient(135deg, transparent, rgba(99, 102, 241, 0.03));
}

.pg-panel-title:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(99, 102, 241, 0.08));
}

.pg-chevron {
    font-size: 0.8rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-tertiary);
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.08);
}

.pg-panel-body {
    max-height: 0;
    overflow: hidden;
    padding: 0 16px;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pg-panel-body.open {
    max-height: 600px;
    padding: 6px 16px 16px;
}

.pg-panel-body.open~.pg-panel-title .pg-chevron,
.pg-panel-title.active .pg-chevron {
    transform: rotate(180deg);
    background: rgba(99, 102, 241, 0.15);
}

.pg-panel-body label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pg-panel-body label:first-child {
    margin-top: 0;
}

.pg-panel-body select,
.pg-panel-body input[type="text"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pg-panel-body select:focus,
.pg-panel-body input[type="text"]:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.pg-panel-body input[type="range"] {
    width: 100%;
    margin-top: 4px;
    accent-color: #6366f1;
    height: 5px;
    border-radius: 3px;
    cursor: pointer;
}

/* Color Row */
.pg-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pg-color-row input[type="color"] {
    width: 38px;
    height: 34px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
}

.pg-color-row span {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    font-family: monospace;
}

/* Radio Group */
.pg-radio-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.pg-radio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 400 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding: 8px 10px;
    border-radius: 0;
    transition: background 0.15s;
    flex: 1;
    text-align: center;
    border-right: 1px solid var(--border-color);
}

.pg-radio:last-child {
    border-right: none;
}

.pg-radio:hover {
    background: rgba(99, 102, 241, 0.06);
}

.pg-radio input[type="radio"] {
    accent-color: #6366f1;
}

/* Checkbox */
.pg-checkbox {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 400 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    margin-bottom: 4px;
}

.pg-checkbox:hover {
    background: rgba(99, 102, 241, 0.05);
}

.pg-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
    cursor: pointer;
}

/* Margin Grid */
.pg-margin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Color Presets */
.pg-color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.pg-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color, #d1d5db);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
    padding: 0;
    outline: none;
}

.pg-color-swatch:hover {
    transform: scale(1.15);
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.pg-color-swatch.active {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    transform: scale(1.1);
}

/* Preview Area */
.pg-preview-area {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    padding: 16px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
}

.pg-preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.pg-preview-toolbar h3 {
    margin: 0;
    font-size: 1rem;
}

.pg-preview-info {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
}

.pg-paper-container {
    display: flex;
    justify-content: center;
    padding: 16px;
    background: var(--bg-tertiary, #f3f4f6);
    border-radius: 8px;
    min-height: 500px;
    overflow: auto;
}

.pg-paper-svg {
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
    border-radius: 2px;
    max-width: 100%;
    height: auto;
}

/* Templates Section */
.pg-templates-section {
    margin-top: 48px;
    text-align: center;
}

.pg-templates-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.pg-templates-section>p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.pg-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    text-align: left;
}

.pg-template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.pg-template-card:hover {
    border-color: #6366f1;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

.pg-template-card .tpl-icon {
    font-size: 1.6rem;
    margin-bottom: 8px;
    display: block;
}

.pg-template-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.pg-template-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 6px;
}

.pg-template-card .tpl-specs {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

/* Responsive */
@media (max-width: 900px) {
    .pg-layout {
        grid-template-columns: 1fr;
    }

    .pg-controls {
        position: static;
        max-height: none;
    }
}

/* Print Styles */
@media print {

    .pg-hero,
    .pg-controls,
    .pg-preview-toolbar,
    .pg-templates-section,
    .main-nav,
    .footer,
    .pg-export-bar {
        display: none !important;
    }

    .pg-workspace {
        padding: 0 !important;
    }

    .pg-layout {
        display: block !important;
    }

    .pg-preview-area {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        background: none !important;
    }

    .pg-paper-container {
        padding: 0 !important;
        background: none !important;
    }

    .pg-paper-svg {
        box-shadow: none !important;
        width: 100% !important;
        max-width: none !important;
    }

    body {
        margin: 0;
        padding: 0;
    }

    @page {
        margin: 0;
    }
}