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

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* 다크 모드 */
body.dark-mode {
    --gray-50: #1f2937;
    --gray-100: #374151;
    --gray-200: #4b5563;
    --gray-300: #6b7280;
    --gray-600: #d1d5db;
    --gray-700: #e5e7eb;
    --gray-900: #f9fafb;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 20px;
}

/* 헤더 */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

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

.header h1 {
    font-size: 24px;
    margin: 0;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.btn-icon {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.btn-logout {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.header-info {
    font-size: 14px;
    opacity: 0.9;
    text-align: center;
}

/* 탭 메뉴 */
.tabs {
    display: flex;
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:active {
    background: var(--gray-100);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

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

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

/* 폼 스타일 */
.form {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-section-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--gray-700);
    margin: 20px 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-200);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 버튼 */
.btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:active {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:active {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:active {
    background: #dc2626;
}

/* 목록 컨트롤 */
.list-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.list-controls input,
.list-controls select {
    padding: 12px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
}

.list-controls input {
    flex: 1;
}

.list-controls select {
    min-width: 120px;
}

/* 아이템 리스트 */
.item-list {
    display: grid;
    gap: 12px;
}

.item-card {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--gray-200);
}

.item-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.item-card:active {
    transform: scale(0.98);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.item-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.item-category {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.item-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.info-item {
    font-size: 13px;
    color: var(--gray-600);
}

.info-label {
    font-weight: 600;
    color: var(--gray-700);
}

.item-dimensions {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.dimension {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dimension-label {
    color: var(--gray-600);
    font-size: 11px;
}

.dimension-value {
    font-weight: 600;
    color: var(--gray-900);
}

.item-notes {
    padding: 10px;
    background: var(--gray-50);
    border-radius: 8px;
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 12px;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

.item-meta {
    font-size: 12px;
    color: var(--gray-600);
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* 관리 섹션 */
.manage-section {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--gray-200);
}

.manage-section h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--gray-900);
}

.manage-section p {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: 15px;
}

.upload-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

#fileName {
    font-size: 14px;
    color: var(--gray-600);
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.danger-zone {
    border: 2px solid var(--danger);
}

.danger-zone h2 {
    color: var(--danger);
}

/* 토스트 알림 */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-900);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    overflow-y: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid var(--gray-200);
}

.modal-header h2 {
    font-size: 20px;
    color: var(--gray-900);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray-600);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:active {
    background: var(--gray-100);
}

/* 빈 상태 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-600);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-text {
    font-size: 16px;
}

/* 반응형 */
@media (min-width: 768px) {
    .container {
        padding-bottom: 40px;
    }

    .header h1 {
        font-size: 32px;
    }

    .tab-btn {
        font-size: 18px;
    }

    .form {
        padding: 30px;
    }

    .item-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-actions,
    .export-buttons {
        flex-direction: row;
    }
}

@media (min-width: 1024px) {
    .item-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 대시보드 스타일 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-card.stat-primary {
    border-left: 4px solid var(--primary);
}

.stat-card.stat-success {
    border-left: 4px solid var(--success);
}

.stat-card.stat-warning {
    border-left: 4px solid var(--warning);
}

.stat-card.stat-info {
    border-left: 4px solid var(--info);
}

.stat-icon {
    font-size: 36px;
    opacity: 0.9;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.quick-actions {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--gray-200);
}

.quick-actions h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.action-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-card:active {
    transform: scale(0.98);
}

.action-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.action-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.action-desc {
    font-size: 12px;
    opacity: 0.9;
}

.dashboard-section {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--gray-200);
}

.dashboard-section h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.category-chart {
    display: grid;
    gap: 12px;
}

.category-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-name {
    min-width: 100px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.category-bar-container {
    flex: 1;
    height: 24px;
    background: var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 8px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    transition: width 0.6s ease;
}

.recent-items-list {
    display: grid;
    gap: 12px;
}

.recent-item {
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.recent-item:hover {
    background: var(--gray-100);
}

.recent-item-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.recent-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.recent-item-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

/* 스켈레톤 로딩 */
.skeleton-card,
.skeleton-item {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-300) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 12px;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}

.skeleton-item {
    height: 200px;
    margin-bottom: 12px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.dashboard-loading,
.list-loading {
    padding: 20px;
}

/* 기관 선택 섹션 */
.organization-selector {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
    color: white;
}

.organization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.organization-header h3 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
}

.organization-content {
    display: flex;
    gap: 10px;
    align-items: center;
}

.organization-select {
    flex: 1;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    transition: var(--transition);
}

.organization-select:focus {
    outline: none;
    border-color: white;
    background: white;
}

.selected-organization-info {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.organization-badge {
    font-size: 14px;
}

.organization-badge strong {
    font-size: 16px;
}

.btn-text {
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-text:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-small {
    max-width: 400px;
}

.modal-body {
    padding: 20px;
}

.organization-list {
    display: grid;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.organization-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 2px solid var(--gray-200);
    transition: var(--transition);
}

.organization-item:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.organization-item-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.organization-item-count {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.organization-item-delete {
    background: var(--danger);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.organization-item-delete:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* 사용자 관리 */
.user-list {
    display: grid;
    gap: 12px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 8px;
    border: 2px solid var(--gray-200);
    transition: var(--transition);
}

.user-item:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.user-role {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 12px;
}

.user-role.admin {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.user-role.user {
    background: var(--gray-200);
    color: var(--text-secondary);
}

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

.role-toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.role-toggle-btn.make-admin {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.role-toggle-btn.make-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.role-toggle-btn.make-user {
    background: var(--gray-300);
    color: var(--text-primary);
}

.role-toggle-btn.make-user:hover {
    background: var(--gray-400);
    transform: translateY(-2px);
}

/* 연속 등록 모드 컨트롤 */
.continuous-mode-control {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--gray-200);
}

.mode-toggle {
    display: flex;
    align-items: center;
}

.toggle-checkbox {
    display: none;
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
    /* CSS 변수로 토글 크기 관리 (반응형 개선) */
    --toggle-width: 48px;
    --toggle-height: 24px;
    --toggle-button-size: 20px;
    --toggle-padding: 2px;
}

.toggle-label::before {
    content: '';
    width: var(--toggle-width);
    height: var(--toggle-height);
    background: var(--gray-300);
    border-radius: calc(var(--toggle-height) / 2);
    transition: background 0.3s;
    flex-shrink: 0;
    display: block;
    order: -1; /* 텍스트보다 먼저 배치 */
}

.toggle-label::after {
    content: '';
    width: var(--toggle-button-size);
    height: var(--toggle-button-size);
    background: white;
    border-radius: 50%;
    position: absolute;
    /* label의 왼쪽 시작점에서 padding만큼 이동 */
    left: var(--toggle-padding);
    top: 50%;
    transform: translateY(-50%);
    transition: left 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.toggle-checkbox:checked + .toggle-label::before {
    background: var(--primary);
}

.toggle-checkbox:checked + .toggle-label::after {
    /* 체크 시 위치: 전체 너비 - 버튼 크기 - 오른쪽 여백 */
    left: calc(var(--toggle-width) - var(--toggle-button-size) - var(--toggle-padding));
}

.toggle-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 항목 선택 모달 */
.field-config-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.field-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.field-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.field-checkbox-item:hover {
    background: var(--gray-100);
}

.field-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.field-checkbox-item input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.field-checkbox-item:has(input:checked) {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
}

.field-checkbox-item:has(input:checked) span {
    font-weight: 600;
}

.field-checkbox-item:has(input:disabled) {
    opacity: 0.8;
    cursor: not-allowed;
}

/* 폼 필드 숨김/표시 */
.form-group[data-field],
.form-row[data-field],
.form-section[data-field] {
    transition: opacity 0.3s, max-height 0.3s;
}

.form-group[data-field].hidden,
.form-row[data-field].hidden,
.form-section[data-field].hidden {
    display: none;
}

/* 탭 전환 애니메이션 */
.tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 모바일 최적화 (768px 미만) */
@media (max-width: 767px) {
    /* 헤더 최적화 */
    .header {
        padding: 12px 16px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .header-user {
        gap: 6px;
        font-size: 12px;
    }
    
    .header-user span {
        display: none; /* 모바일에서는 사용자 이름 숨김 */
    }
    
    .btn-icon,
    .btn-logout {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    .header-info {
        font-size: 12px;
    }
    
    /* 탭 메뉴 최적화 */
    .tabs {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .tab-btn {
        padding: 12px 8px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* 컨테이너 최적화 */
    .container {
        padding-bottom: 16px;
    }
    
    .tab-content {
        padding: 12px;
    }
    
    /* 대시보드 최적화 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }
    
    .stat-card {
        padding: 14px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .stat-icon {
        font-size: 28px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    /* 빠른 액션 버튼 최적화 */
    .quick-actions {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .quick-actions h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .action-card {
        padding: 16px;
    }
    
    .action-icon {
        font-size: 28px;
        margin-bottom: 6px;
    }
    
    .action-title {
        font-size: 14px;
    }
    
    .action-desc {
        font-size: 11px;
    }
    
    /* 대시보드 섹션 최적화 */
    .dashboard-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .dashboard-section h2 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .category-name {
        min-width: 70px;
        font-size: 12px;
    }
    
    .category-bar-container {
        height: 20px;
    }
    
    .category-bar-fill {
        font-size: 10px;
        padding: 0 6px;
    }
    
    .recent-item {
        padding: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .recent-item-info h4 {
        font-size: 13px;
    }
    
    .recent-item-meta {
        font-size: 11px;
    }
    
    .recent-item-badge {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    /* 폼 최적화 */
    .form {
        padding: 16px;
        border-radius: 10px;
    }
    
    .form-section-title {
        font-size: 14px;
        margin: 16px 0 8px 0;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 8px;
        margin-top: 16px;
    }
    
    /* 버튼 최적화 */
    .btn {
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    .btn-small {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    /* 목록 컨트롤 최적화 */
    .list-controls {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .list-controls input,
    .list-controls select {
        padding: 10px;
        font-size: 14px;
        border-radius: 6px;
        width: 100%;
    }
    
    /* 아이템 카드 최적화 */
    .item-list {
        gap: 10px;
        grid-template-columns: 1fr;
    }
    
    .item-card {
        padding: 14px;
        border-radius: 10px;
    }
    
    .item-card:hover {
        transform: none; /* 모바일에서는 호버 효과 제거 */
    }
    
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .item-title {
        font-size: 16px;
    }
    
    .item-category {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .item-info {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .info-item {
        font-size: 12px;
    }
    
    .item-dimensions {
        gap: 8px;
        padding: 8px;
        margin-bottom: 10px;
        font-size: 12px;
    }
    
    .dimension-label {
        font-size: 10px;
    }
    
    .item-notes {
        padding: 8px;
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .item-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-top: 10px;
    }
    
    .item-meta {
        font-size: 11px;
    }
    
    .item-actions {
        width: 100%;
        gap: 6px;
    }
    
    .item-actions button {
        flex: 1;
        font-size: 12px;
        padding: 8px;
    }
    
    /* 관리 섹션 최적화 */
    .manage-section {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 10px;
    }
    
    .manage-section h2 {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .manage-section p {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .upload-area {
        flex-direction: column;
        gap: 10px;
    }
    
    #fileName {
        font-size: 12px;
        word-break: break-all;
    }
    
    .export-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    /* 모달 최적화 */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 95vh;
        border-radius: 10px;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .close-btn {
        font-size: 24px;
        width: 28px;
        height: 28px;
    }
    
    /* 토스트 최적화 */
    .toast {
        bottom: 16px;
        left: 10px;
        right: 10px;
        transform: translateX(0) translateY(100px);
        padding: 14px 18px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .toast.show {
        transform: translateX(0) translateY(0);
    }
    
    /* 빈 상태 최적화 */
    .empty-state {
        padding: 40px 16px;
    }
    
    .empty-state-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }
    
    .empty-state-text {
        font-size: 14px;
    }
    
    /* 스켈레톤 최적화 */
    .skeleton-card {
        height: 100px;
        margin-bottom: 12px;
    }
    
    .skeleton-item {
        height: 150px;
        margin-bottom: 10px;
    }
    
    .dashboard-loading,
    .list-loading {
        padding: 12px;
    }
}

/* 초소형 모바일 (360px 미만) */
@media (max-width: 359px) {
    .header h1 {
        font-size: 16px;
    }
    
    .tab-btn {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 13px;
    }
    
    .btn {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    /* 터치 영역 확대 */
    .btn,
    .tab-btn,
    .btn-icon,
    .btn-logout {
        min-height: 44px; /* iOS 권장 최소 터치 영역 */
    }
    
    .list-controls input,
    .list-controls select,
    .form-group input,
    .form-group select {
        min-height: 44px;
    }
    
    /* 호버 효과 제거 */
    .stat-card:hover,
    .action-card:hover,
    .item-card:hover,
    .recent-item:hover {
        transform: none;
        box-shadow: var(--shadow);
    }
    
    /* 터치 피드백 */
    .btn:active,
    .tab-btn:active,
    .action-card:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* =============================================== */
/* 📄 페이지네이션 (관리자 전용) */
/* =============================================== */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.pagination-controls button {
    min-width: 120px;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 16px;
    min-width: 100px;
    text-align: center;
}

/* 모바일 페이지네이션 최적화 */
@media (max-width: 768px) {
    .pagination-controls {
        gap: 12px;
        padding: 16px;
        margin-top: 20px;
    }
    
    .pagination-controls button {
        min-width: 100px;
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .page-info {
        font-size: 14px;
        min-width: 80px;
    }
}

