/**
 * 바코드 저장/관리 시스템 스타일
 */

/* ===== 메인 레이아웃 (3단) ===== */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.main-layout > .form-section {
    grid-column: 1;
}

.main-layout > .preview-section {
    grid-column: 2;
}

.main-layout > .sidebar {
    grid-column: 3;
    grid-row: 1 / 3;
}

/* ===== 사이드바 레이아웃 ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: fit-content;
}

.sidebar-section {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.section-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* ===== 카테고리 스타일 ===== */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    background: #f8f9fa;
}

.category-item:hover {
    background: #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-item.active {
    background: #e3f2fd;
    font-weight: 600;
    border-left: 4px solid #1976d2;
}

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

.category-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-name {
    font-size: 0.95rem;
    flex: 1;
}

.category-count {
    color: #666;
    font-size: 0.85rem;
}

.category-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-item:hover .category-actions {
    opacity: 1;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    color: #666;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.btn-add-category {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* ===== 검색 & 정렬 ===== */
.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.search-box input {
    padding-left: 2.5rem;
}

.sort-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.sort-box label {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.sort-box select {
    flex: 1;
    font-size: 0.9rem;
    padding: 0.375rem 0.75rem;
}

/* ===== 바코드 카드 ===== */
.barcode-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

.barcode-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    background: white;
}

.barcode-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #1976d2;
}

.barcode-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.barcode-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.barcode-type-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.barcode-preview-small {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.5rem;
    text-align: center;
    margin-bottom: 0.75rem;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.barcode-preview-small img {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
}

.barcode-preview-small .placeholder {
    color: #999;
    font-size: 0.85rem;
}

.barcode-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.barcode-info-row i {
    margin-right: 0.25rem;
}

.barcode-description {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.barcode-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.barcode-actions .btn {
    flex: 1;
    min-width: 70px;
    font-size: 0.85rem;
    padding: 0.375rem 0.75rem;
}

/* ===== 빈 상태 ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-state small {
    font-size: 0.9rem;
}

/* ===== 모달 ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h5 {
    margin: 0;
    font-size: 1.25rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.btn-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ===== 토스트 알림 ===== */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification i {
    font-size: 1.25rem;
}

.toast-success {
    border-left: 4px solid #2ecc71;
}

.toast-success i {
    color: #2ecc71;
}

.toast-error {
    border-left: 4px solid #e74c3c;
}

.toast-error i {
    color: #e74c3c;
}

.toast-info {
    border-left: 4px solid #3498db;
}

.toast-info i {
    color: #3498db;
}

/* ===== 모바일 탭 (기본 숨김) ===== */
.mobile-tabs {
    display: none;
}

/* ===== 데스크톱: 모든 섹션 표시 ===== */
@media (min-width: 768px) {
    .tab-content {
        display: block !important;
    }
}

/* ===== 반응형: 태블릿 (768px - 1199px) ===== */
@media (max-width: 1199px) {
    .main-layout {
        grid-template-columns: 1fr 350px;
    }

    .main-layout > .form-section {
        grid-column: 1;
    }

    .main-layout > .preview-section {
        grid-column: 1;
    }

    .main-layout > .sidebar {
        grid-column: 2;
        grid-row: 1 / 3;
    }
}

/* ===== 반응형: 모바일 (< 768px) ===== */
@media (max-width: 767px) {
    .main-layout {
        display: block;
    }

    /* 모바일 탭 네비게이션 */
    .mobile-tabs {
        display: flex;
        background: white;
        border-radius: 10px;
        margin-bottom: 1rem;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .mobile-tab {
        flex: 1;
        padding: 1rem;
        text-align: center;
        border: none;
        background: #f8f9fa;
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: 500;
        color: #666;
    }

    .mobile-tab.active {
        background: #1976d2;
        color: white;
    }

    .mobile-tab i {
        display: block;
        margin-bottom: 0.25rem;
        font-size: 1.2rem;
    }

    /* 탭 콘텐츠 */
    .tab-content {
        display: none;
    }

    .tab-content.active {
        display: block;
    }

    /* 사이드바 조정 */
    .sidebar {
        max-height: none;
    }

    .barcode-list {
        max-height: 500px;
    }

    .category-list {
        max-height: 400px;
    }
}

/* ===== 스크롤바 스타일 ===== */
.barcode-list::-webkit-scrollbar,
.category-list::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.barcode-list::-webkit-scrollbar-track,
.category-list::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.barcode-list::-webkit-scrollbar-thumb,
.category-list::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.barcode-list::-webkit-scrollbar-thumb:hover,
.category-list::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}
