/* 프리미엄 CSS (글래스모피즘, 모던 테마) */
:root {
    --bg-color: #f4f7fb;
    --card-bg: rgba(255, 255, 255, 0.85);
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: rgba(229, 231, 235, 0.8);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --highlight: rgba(74, 222, 128, 0.4);
    --highlight-text: #065f46;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
}

body {
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; 
    word-break: keep-all;
    overflow-wrap: break-word;
}

.app-container {
    display: flex;
    height: 94vh;
    max-width: 1600px;
    margin: 3vh auto;
    padding: 0 20px;
    gap: 25px;
    align-items: stretch;
}

.control-panel {
    width: 420px;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 8px;
}
/* Custom scrollbar for control panel */
.control-panel::-webkit-scrollbar {
    width: 6px;
}
.control-panel::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 4px;
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 20px;
    gap: 15px;
    overflow: hidden;
}

.step-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 14px 18px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}
.header p {
    font-size: 13px;
    color: var(--text-muted);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.step-header h2 {
    font-size: 15px;
    font-weight: 600;
}

.tooltip {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 250px;
    background-color: #374151;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: var(--shadow);
}
.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.premium-select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.premium-select:focus {
    border-color: var(--primary-color);
}
.premium-select.mini {
    width: 80px;
}

.range-selectors {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.range-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.combo-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.file-drop-area {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}
.file-drop-area:hover, .file-drop-area.drag-over {
    border-color: var(--primary-color);
    background: #eff6ff;
}
.drop-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}
.file-drop-area p {
    font-size: 13px;
    color: var(--text-muted);
}
.file-name {
    font-size: 12px;
    color: var(--primary-color);
    margin-top: 8px;
    font-weight: 500;
}
.file-list-container {
    display: flex;
}
.file-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    width: 100%;
}
.file-row-name {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.file-row-delete {
    cursor: pointer;
    color: #ef4444;
    font-size: 14px;
    font-weight: bold;
    padding-left: 10px;
}
.file-row-delete:hover {
    color: #b91c1c;
}

.header-row-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}
.header-row-setting input {
    width: 60px;
    padding: 5px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.action-card {
    display: flex;
    gap: 10px;
}
.premium-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, filter 0.2s;
}
.premium-btn:active {
    transform: scale(0.98);
}
.premium-btn.primary {
    background: var(--primary-color);
    color: white;
}
.premium-btn.primary:hover {
    background: var(--primary-hover);
}
.premium-btn.primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}
.premium-btn.secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.premium-btn.secondary:hover {
    background: #f1f5f9;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.preview-header h2 {
    font-size: 18px;
}
.preview-header .left-group {
    display: flex;
    align-items: center;
    gap: 15px;
}
.sheet-selector-group {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
}
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #e5e7eb;
    color: #4b5563;
}
.badge.active { background: #dbeafe; color: #1d4ed8; }
.badge.success { background: #d1fae5; color: #065f46; }

.table-container {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    position: relative;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
th, td {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 150px;
}
th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
}
@keyframes highlight-flash {
    0% { background-color: rgba(74, 222, 128, 0.6); }
    100% { background-color: var(--highlight); }
}
tr.updated {
    animation: highlight-flash 1s ease-out forwards;
}
tr.updated td {
    color: var(--highlight-text);
    font-weight: 500;
}

.placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #9ca3af;
    font-size: 14px;
}

.progress-section {
    height: 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
}
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.log-console {
    flex: 1;
    background: #1e293b;
    color: #38bdf8;
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.log-line { word-break: break-all; }
.log-line.error { color: #f87171; }
.log-line.success { color: #4ade80; }
.log-line.warn { color: #facc15; }

/* 3단 레이아웃 및 신규 UI 요소 스타일 */
.ad-panel {
    width: 200px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.ad-slot.vertical-ad {
    flex: 1;
    background: var(--card-bg);
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    justify-content: center;
}

.ad-panel-footer {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.ad-panel-footer .footer-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}
.ad-panel-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}
.ad-panel-footer a:hover {
    text-decoration: underline;
}
.ad-panel-footer .copyright {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 5px;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
.header-top-row h1 {
    margin-bottom: 0;
}

.security-badge {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 10px;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.placeholder-banner {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.placeholder-banner h4 {
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}
.placeholder-banner p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}
.coffee-btn {
    background: #ffdd00;
    color: #000000;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s;
}
.coffee-btn:hover {
    transform: scale(1.05);
}

/* Template drop area redesign - Horizontal Pill layout */
#template-drop-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    margin-bottom: 5px;
    border-radius: 10px;
}
#template-drop-area .drop-icon {
    font-size: 22px;
    margin-bottom: 0;
}
#template-drop-area p {
    font-size: 14px;
    margin-bottom: 0;
}

/* File list internal scroll for multiple files */
#target-file-names {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 5px;
}
#target-file-names::-webkit-scrollbar {
    width: 5px;
}
#target-file-names::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 4px;
}
