/* ===== TapViet Studio — Style Sheet ===== */

/* === FONTS === */
/* Font 5 hàng — dùng cho grid 5 ô ly (cỡ to HK1 lớp 1) */
@font-face { font-family: 'HP001 5 hàng thường'; src: url('../fonts/HP001-5-hang-thuong.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 5 hàng đậm'; src: url('../fonts/HP001-5-hang-dam.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 5 hàng thanh đậm'; src: url('../fonts/HP001-5-hang-thanh-dam.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 5 hàng đậm nét'; src: url('../fonts/HP001-5-hang-dam-net.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 4 hàng thường'; src: url('../fonts/HP001-4-hang-thuong.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 4 hàng đậm'; src: url('../fonts/HP001-4-hang-dam.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 4 hàng thanh đậm'; src: url('../fonts/HP001-4-hang-thanh-dam.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 4 hàng đậm nét'; src: url('../fonts/HP001-4-hang-dam-net.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 4 hàng thanh đậm chưa'; src: url('../fonts/HP001-4-hang-thanh-dam-chua.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 4 hàng đậm nét chưa'; src: url('../fonts/HP001-4-hang-dam-net-chua.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'HP001 TD 4 hàng'; src: url('../fonts/HP001-TD-4-hang.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'UNI Tap Viet 0'; src: url('../fonts/UNITapviet_0_ly.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'UNI Tap Viet 5'; src: url('../fonts/UNITapviet_5_ly.ttf') format('truetype'); font-display: swap; }


/* === CSS VARIABLES === */
:root {
    --bg-color: #0b0f19;
    --sidebar-bg: rgba(17, 24, 39, 0.95);
    --card-bg: rgba(31, 41, 55, 0.5);
    --accent-color: #4f46e5;
    --accent-hover: #6366f1;
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: rgba(75, 85, 99, 0.3);
    --card-border: rgba(255, 255, 255, 0.05);
}


/* === RESET === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: space-between;
    overflow: hidden;
}


/* === SIDEBARS === */
.sidebar-left {
    width: 300px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    z-index: 10;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.2);
}

.sidebar-right {
    width: 310px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    z-index: 10;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.2);
}


/* === LOGO === */
.logo-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

.logo-section h1 {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-section p {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}


/* === SECTION TITLE === */
.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-top: 6px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 4px;
}


/* === FORM ELEMENTS === */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;  /* Tăng khoảng cách giữa các cấu hình */
}

label {
    font-size: 0.72rem;   /* Giảm nhẹ để tạo phân cấp thị giác */
    font-weight: 500;
    color: var(--text-muted);  /* Màu xám nhạt như text-gray-400 */
    display: flex;
    justify-content: space-between;
}

label span.value {
    color: var(--accent-hover);
    font-weight: 600;
}

select {
    width: 100%;
    background-color: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    padding: 8px 10px;
    font-size: 0.82rem;
    outline: none;
    transition: all 0.3s;
}

select:focus {
    border-color: var(--accent-color);
}


/* === SLIDERS === */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--accent-hover);
}


/* === PREVIEW AREA === */
.preview-area {
    flex: 1;
    height: 100vh;
    background-color: #111827;
    overflow: auto;
    position: relative;
}

#preview-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100%;
    padding: 24px;
    box-sizing: border-box;
    position: relative;
}

#zoom-wrapper {
    overflow: visible;
    flex-shrink: 0;
}


/* === A4 PAGE === */
.a4-page {
    width: 794px;
    height: 1123px;
    background-color: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    box-sizing: border-box;
    transform-origin: top center;
    transition: transform 0.2s;
    overflow: hidden;
    cursor: text;
}

.a4-page.landscape {
    width: 1123px;
    height: 794px;
}


/* === FLOATING INPUT === */
#floating-input {
    position: absolute;
    border: none;
    background: transparent;
    outline: none;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    z-index: 5;
    color: transparent;
    -webkit-text-fill-color: transparent;
    caret-color: #ef4444;
    text-shadow: none;
    display: none;
}

.interactive-row-overlay {
    position: absolute;
    left: 0;
    width: 100%;
    background-color: rgba(79, 70, 229, 0.02);
    cursor: text;
    z-index: 2;
    transition: background-color 0.15s;
}

.interactive-row-overlay:hover {
    background-color: rgba(79, 70, 229, 0.05);
}


/* === BUTTONS === */
.btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}

.btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}


/* === GUIDELINES === */
.guideline-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.74rem;
    line-height: 1.4;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guideline-title {
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.guideline-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.guideline-badge {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    width: fit-content;
    margin-bottom: 2px;
}


/* === ZOOM TOOLBAR === */
.zoom-toolbar {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 10px;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.zoom-toolbar button {
    background: transparent;
    border: none;
    color: var(--text-color);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}

.zoom-toolbar button:hover {
    background: rgba(255,255,255,0.08);
}

.zoom-toolbar button:active {
    background: rgba(255,255,255,0.12);
}

#zoom-level-display {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 42px;
    text-align: center;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s;
    user-select: none;
    line-height: 1;
}

#zoom-level-display:hover {
    background: rgba(255,255,255,0.08);
}


/* === PRINT === */
@media print {
    body {
        background-color: #ffffff;
        color: #000000;
        overflow: visible;
        height: auto;
    }
    .sidebar-left, .sidebar-right {
        display: none !important;
    }
    .preview-area {
        padding: 0 !important;
        background-color: #ffffff !important;
        overflow: visible !important;
        height: auto !important;
        width: 100% !important;
    }
    #pages-container {
        gap: 0 !important;
        display: block !important;
        width: 100% !important;
    }
    .a4-page {
        box-shadow: none !important;
        margin: 0 auto !important;
        border: none !important;
        width: 210mm !important;
        height: 297mm !important;
        page-break-after: always;
        page-break-inside: avoid;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
    }
    .a4-page.landscape {
        width: 297mm !important;
        height: 210mm !important;
    }
    .a4-page:last-child {
        page-break-after: auto;
    }
    #floating-input, .interactive-row-overlay, .zoom-toolbar {
        display: none !important;
    }
}
