/* Matching Lists specific styles */
#generate-random-btn {
    background: rgba(255, 215, 0, 0.3);
}

#pair-count-display {
    margin-top: 0.5rem;
    margin-bottom: 0.8rem;
    text-align: center;
}

#add-pair-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

#add-pair-btn {
    background: rgba(255, 215, 0, 0.3);
    color: #000;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-right: 2rem;
    margin-bottom: 1rem;
}

.clear-btn {
    background: rgba(255, 68, 68, 0.7);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.word-pair-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    height: 400px;
    overflow-y: auto;
    padding-right: 1rem;
    padding-left: 0.5rem;
    counter-reset: pair-number;
}

.word-pair {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 1.5rem;
    counter-increment: pair-number;
}

.word-pair.over-limit .word-input-field {
    text-decoration: line-through;
    color: #aaa;
    border-color: rgba(255, 0, 0, 0.4);
}

.word-pair::before {
    content: counter(pair-number);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 500;
    color: #666;
    min-width: 1rem;
    text-align: left;
}

.word-input-field {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
}

.word-input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.1);
}

.remove-pair {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s ease;
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.remove-pair:hover {
    color: #ff0000;
    background-color: rgba(255, 68, 68, 0.1);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin: 0;
    text-align: center;
}

.reset-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.3rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    color: #4a90d9;
    transform: scale(1.2);
}

/* Matching Lists Preview Styles */
.matching-list {
    position: relative;
    display: flex;
    justify-content: space-between;
    padding: 2rem;
    gap: 12rem;  /* 8rem에서 12rem으로 간격 증가 */
}

.list-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.list-column.left {
    align-items: flex-start;
    width: 120px;
    position: relative;
}

.list-column.left .list-item {
    display: flex;
    align-items: center;
    padding-left: 1rem;
    width: 100%;
}

.list-column.right {
    align-items: flex-end;
    width: auto;
    position: relative;
}

.list-column.right .list-item {
    width: 120px;
    justify-content: flex-end;
    padding-right: 0;
    position: relative;
}

.list-column.right .connection-point {
    left: -0.5rem;
}

/* List item styles */
.list-item {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 2rem;
}

.list-column.right .list-item {
    width: 140px;
    justify-content: flex-end;
    padding-right: 0;
}

/* Connection point styles */
.connection-point {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #666;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-column.left .connection-point {
    right: -4.5rem;
}

.list-column.right .connection-point {
    left: -0.5rem;
}

.connection-point:hover {
    background: #333;
}

/* Answer number styles */
.answer-number {
    margin-left: 0.5rem;
    font-weight: bold;
    color: #ff4444;
    font-size: 1em;
}

/* Make sure list items have proper positioning */
.list-item {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 2rem;
    width: fit-content;
}

.list-item .number {
    margin-right: 0.5rem;
    min-width: 1.5rem;
}

/* Align right column items */
.list-column.right .list-item {
    text-align: left;
    margin-left: 1rem;
}

.list-column.right .list-item {
    width: 160px;
    justify-content: flex-end;
}

/* Line drawing canvas */
.matching-list {
    position: relative;
}

/* Canvas positioning */
#connection-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Active state for connection points */
.list-item.active::after {
    background: var(--primary-color);
}

/* Drawing line style */
.drawing-line {
    position: absolute;
    height: 2px;
    background: var(--primary-color);
    transform-origin: left center;
    pointer-events: none;
    z-index: 1;
}

.list-item::before {
    content: counter(item);
    position: absolute;
    left: -2rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 500;
    color: #666;
}

.list-column.right .list-item::before {
    content: "•";
    position: absolute;
    right: calc(100% - 0.8rem);
    font-size: 1.5rem;
    line-height: 1;
}

/* Hide data-index numbers */
.list-item::before {
    display: none !important;
}

.list-item[data-index]::before {
    display: none !important;
}

/* Print Styles */
@media print {
    @page {
        size: A4;
        margin: 0;
    }

    /* Hide elements that should not be printed */
    .navbar,
    .utility-nav,
    .main-header,
    .top-menu,
    .input-section,
    .preview-label,
    .preview-actions,
    .description-section,
    footer {
        display: none !important;
    }

    /* Tighten matching list padding so 15 items fit on one A4 page */
    .matching-list {
        padding: 0.5rem 2rem !important;
    }

    /* Ensure connection points are visible in print */
    .connection-point {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Reset styles for the print containers */
    body,
    .generator-container,
    .generator-content,
    .preview-section,
    .preview-wrapper {
        background: white !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        display: block !important;
        overflow: visible !important;
    }

    #puzzle-preview {
        transform: none !important;
        width: 210mm !important;
        height: 297mm !important;
        padding: 20mm !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        box-sizing: border-box !important;
        position: relative !important;
        background: white !important;
        display: block !important;
        overflow: visible !important;
    }

.matching-list {
        page-break-inside: avoid;
    }

    .answer-btn {
        display: none !important;
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .matching-list {
        flex-direction: column;
        gap: 1rem;
    }

    .list-column.left,
    .list-column.right {
        align-items: center;
    }

    .list-item {
        width: 100%;
        max-width: 300px;
    }

    .word-pair {
        flex-direction: column;
        gap: 0.5rem;
    }

    .word-input-field {
        width: calc(100% - 3rem);
    }
}

/* Student Header Styles */
.student-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
}

.puzzle-header {
    display: flex;
    align-items: center;
}

.preview-logo {
    height: 40px;
    margin-right: 1rem;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-line {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.info-line label {
    min-width: 60px;
    font-weight: 500;
}

.input-field {
    width: 200px;
    height: 1.5rem;
    border-bottom: 1px solid #000;
}

/* Empty Matching Lists Content */
.matching-content {
    margin: 2rem auto;
    max-width: 800px;
}

.matching-lists {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.left-list,
.right-list {
    flex: 1;
    min-height: 300px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

/* Worksheet Title */
.puzzle-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 1rem 0 2rem;
    padding: 0.5rem;
}

/* Hide the '0' numbers */
.list-item::first-letter {
    display: none;
}

/* Font size variations */
.matching-list.font-small .list-item {
    font-size: 12pt;
}

.matching-list.font-medium .list-item {
    font-size: 14pt;
}

.matching-list.font-large .list-item {
    font-size: 16pt;
}

/* Options box styles */
.options {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.options .option-group {
    margin-bottom: 1rem;
}

.options .option-group:last-child {
    margin-bottom: 0;
}

.options h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #333;
}

.options .centered-title {
    text-align: center;
}

.case-options {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    width: 100%;
    padding: 0 calc(50% - 11.5rem);
}

/* Specific styling for font size options */
.option-group:last-child .case-options {
    gap: 3rem;
}

.case-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.case-option input[type="radio"] {
    margin: 0;
}

.case-option label {
    font-size: 1rem;
    color: #666;
    cursor: pointer;
} 