/**
 * Base64 이미지 변환기 스타일
 * Base64 <-> 이미지 양방향 변환
 *
 * @package Zipper
 */

#base64ImageConverter {
    overflow: hidden;
}

#base64ImageConverter [hidden] {
    display: none !important;
}

.b64img-tool-intro {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.b64img-tool-lead,
.b64img-card-note,
.b64img-overview-note,
.b64img-empty-state span,
.b64img-help-note span,
.b64img-note-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #5f5a56;
}

.b64img-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.b64img-overview-card,
.b64img-card {
    border: 1px solid #e8e4dc;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
    box-sizing: border-box;
}

.b64img-overview-card {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    background: linear-gradient(180deg, #fffdfa 0%, #faf7f0 100%);
}

.b64img-overview-label,
.b64img-stat-label,
.b64img-summary-label {
    font-size: 12px;
    font-weight: 600;
    color: #7a726c;
}

.b64img-overview-value,
.b64img-stat-value,
.b64img-summary-value,
.b64img-file-pill span,
.b64img-status-chip {
    font-size: 14px;
    font-weight: 700;
    color: #2d2a26;
}

.b64img-tabs {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-bottom: 18px;
}

.b64img-tab,
.b64img-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 14px;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    background: #fff;
    color: #5f5a56;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s ease;
    box-sizing: border-box;
}

.b64img-tab:hover,
.b64img-btn:hover:not(:disabled),
.b64img-toggle-card:hover,
.b64img-dropzone:hover,
.b64img-dropzone.dragover {
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.08);
}

.b64img-tab.active {
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    border-color: #d4af37;
    color: #8a6500;
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.14);
}

.b64img-tab:focus-visible,
.b64img-btn:focus-visible,
.b64img-textarea:focus-visible,
.b64img-output-textarea:focus-visible,
.b64img-toggle-card:focus-within,
.b64img-dropzone:focus-within {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

.b64img-workbench {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.b64img-input-col,
.b64img-result-col,
.b64img-stat-grid,
.b64img-summary-grid,
.b64img-preview-shell,
.b64img-preview-container,
.b64img-output-wrap,
.b64img-textarea,
.b64img-output-textarea {
    min-width: 0;
}

.b64img-input-col {
    position: sticky;
    top: 20px;
}

.b64img-result-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.b64img-card {
    display: grid;
    gap: 12px;
    padding: 18px;
    background: #fff;
}

.b64img-panel {
    display: block;
}

.b64img-input-card {
    gap: 14px;
}

.b64img-preview-content {
    display: block;
}

.b64img-preview-card,
.b64img-output-card {
    background: linear-gradient(180deg, #fffdfa 0%, #faf7f0 100%);
    box-shadow: 0 10px 24px rgba(212, 175, 55, 0.12);
}

.b64img-summary-card {
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    border-color: #eadfb8;
    box-shadow: 0 8px 18px rgba(212, 175, 55, 0.12);
}

.b64img-card-head,
.b64img-card-head-stack,
.b64img-input-section,
.b64img-help-note,
.b64img-empty-state,
.b64img-toggle-copy,
.b64img-toggle-control,
.b64img-inline-message {
    display: flex;
    gap: 8px;
}

.b64img-card-head,
.b64img-toggle-card {
    align-items: flex-start;
    justify-content: space-between;
}

.b64img-card-head-stack,
.b64img-input-section,
.b64img-help-note,
.b64img-empty-state,
.b64img-toggle-copy,
.b64img-inline-message {
    flex-direction: column;
}

.b64img-card-title,
.b64img-help-note i,
.b64img-empty-state i,
.b64img-file-pill i,
.b64img-inline-message i,
.b64img-overview-card i {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.b64img-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1816;
}

.b64img-card-title i,
.b64img-help-note i,
.b64img-file-pill i,
.b64img-empty-state i,
.b64img-inline-message i {
    color: #d4af37;
}

.b64img-input-label {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

.b64img-textarea,
.b64img-output-textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid #e8e4dc;
    border-radius: 14px;
    background: #fff;
    color: #2d2a26;
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.b64img-textarea {
    min-height: 220px;
}

.b64img-output-textarea {
    min-height: 260px;
    word-break: break-all;
    background: #fffdfa;
}

.b64img-textarea:hover,
.b64img-output-textarea:hover {
    border-color: #d4af37;
}

.b64img-textarea:focus,
.b64img-output-textarea:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    background: #fff;
}

.b64img-stat-grid,
.b64img-summary-grid {
    display: grid;
    gap: 10px;
}

.b64img-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.b64img-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.b64img-stat-card,
.b64img-summary-item {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid #ece4cf;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
}

.b64img-summary-value,
.b64img-stat-value {
    word-break: break-word;
}

.b64img-status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.12);
    color: #8a6500;
    white-space: nowrap;
}

.b64img-preview-shell {
    display: grid;
    gap: 12px;
}

.b64img-preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 18px;
    border: 1px solid #ece4cf;
    border-radius: 16px;
    background: repeating-conic-gradient(#efe5d3 0% 25%, #fffaf3 0% 50%) 50% / 18px 18px;
    overflow: auto;
    box-sizing: border-box;
}

.b64img-preview-container img {
    display: block;
    max-width: 100%;
    max-height: 420px;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 8px 18px rgba(45, 42, 38, 0.12);
}

.b64img-empty-state {
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 24px 20px;
    border: 1px dashed #e0d7c2;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    text-align: center;
    box-sizing: border-box;
}

.b64img-empty-state i {
    font-size: 34px;
}

.b64img-empty-state p {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #2d2a26;
}

.b64img-dropzone {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 28px 20px;
    border: 2px dashed #d8caa8;
    border-radius: 16px;
    background: #faf7ef;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.b64img-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.b64img-dropzone-icon {
    font-size: 34px;
    color: #d4af37;
}

.b64img-dropzone-text {
    font-size: 15px;
    font-weight: 700;
    color: #2d2a26;
}

.b64img-dropzone-hint {
    font-size: 13px;
    line-height: 1.5;
    color: #6b645f;
}

.b64img-toggle-card {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #e8e4dc;
    border-radius: 14px;
    background: #faf9f7;
    cursor: pointer;
    box-sizing: border-box;
}

.b64img-toggle-copy strong {
    font-size: 14px;
    color: #2d2a26;
}

.b64img-toggle-copy span {
    font-size: 13px;
    line-height: 1.5;
    color: #5f5a56;
}

.b64img-toggle-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    color: #8a6500;
}

.b64img-toggle-control input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #d4af37;
}

.b64img-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.b64img-actions-tight {
    margin-top: 2px;
}

.b64img-btn {
    flex: 1 1 140px;
}

.b64img-btn-primary {
    background: linear-gradient(135deg, #fdfbf5 0%, #f7f0e1 100%);
    border-color: #d4c67a;
    color: #2d2a26;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.12);
}

.b64img-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #f8f1df 0%, #f4e8cb 100%);
}

.b64img-btn-secondary {
    background: #fff;
}

.b64img-btn:disabled {
    opacity: 0.56;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.b64img-help-note,
.b64img-file-pill,
.b64img-inline-message {
    padding: 12px 14px;
    border-radius: 14px;
    box-sizing: border-box;
}

.b64img-help-note {
    align-items: flex-start;
    background: rgba(212, 175, 55, 0.1);
    color: #5f5a56;
}

.b64img-file-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f9ef;
    border: 1px solid #cde0aa;
    color: #466031;
}

.b64img-inline-message {
    display: flex;
    align-items: flex-start;
    background: #fff7f0;
    border: 1px solid #f1c89f;
    color: #9a4b12;
}

.b64img-error i {
    color: #d77728;
}

.b64img-note-card p {
    margin: 0;
}

@media (max-width: 1080px) {
    .b64img-overview-grid,
    .b64img-workbench {
        grid-template-columns: 1fr;
    }

    .b64img-input-col {
        position: static;
    }
}

@media (max-width: 900px) {
    .b64img-stat-grid {
        grid-template-columns: 1fr;
    }

    .b64img-tab,
    .b64img-btn,
    .b64img-toggle-card,
    .b64img-textarea,
    .b64img-output-textarea {
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 768px) {
    .b64img-tabs,
    .b64img-actions {
        grid-template-columns: 1fr;
    }

    .b64img-tabs {
        display: grid;
    }

    .b64img-card,
    .b64img-overview-card {
        padding: 16px;
    }

    .b64img-card-head,
    .b64img-toggle-card {
        flex-direction: column;
        align-items: stretch;
    }

    .b64img-status-chip,
    .b64img-toggle-control {
        align-self: flex-start;
    }

    .b64img-preview-container,
    .b64img-empty-state,
    .b64img-output-textarea {
        min-height: 240px;
    }

    .b64img-btn {
        width: 100%;
        flex-basis: 100%;
    }
}

@media (max-width: 480px) {
    #base64ImageConverter,
    .b64img-card,
    .b64img-overview-card,
    .b64img-preview-container,
    .b64img-empty-state,
    .b64img-textarea,
    .b64img-output-textarea {
        max-width: 100%;
        overflow-x: hidden;
    }

    .b64img-summary-grid {
        grid-template-columns: 1fr;
    }

    .b64img-preview-container,
    .b64img-empty-state {
        min-height: 200px;
        padding: 16px;
    }

    .b64img-output-textarea,
    .b64img-textarea {
        min-height: 200px;
    }
}
