/* 설정 페이지 스타일 - 최신 트렌드 */

.settings-content {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: calc(100vh - var(--header-height));
}

/* 설정 사이드바 */
.settings-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.settings-nav {
    background: white;
    border-radius: 20px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-100);
    position: sticky;
    top: 2rem;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.settings-nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.settings-nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
}

.settings-nav-item .nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.settings-nav-item .nav-label {
    font-size: 0.9375rem;
}

/* 설정 패널 */
.settings-panel {
    flex: 1;
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--gray-100);
}

.settings-section {
    display: none;
}

.settings-section.active {
    display: block;
    animation: fadeInUp 0.4s ease;
}

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

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 2rem;
    position: relative;
    padding-left: 1rem;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 28px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 2px;
}

/* 설정 그룹 */
.setting-group {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-100);
}

.setting-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-group h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1.5rem;
}

/* 설정 항목 */
.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.setting-item small {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

/* 폼 요소 */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 0.9375rem;
    transition: all 0.2s;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* 토글 스위치 */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.toggle-label span:first-child {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* 프로필 섹션 */
.profile-header {
    margin-bottom: 2rem;
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.profile-avatar img[src]:not([src=""]) {
    display: block;
}

#avatarInitial {
    color: white;
    font-size: 2rem;
    font-weight: 700;
}

.profile-avatar img:not([src=""]) ~ #avatarInitial {
    display: none;
}

/* 회사 로고 섹션 */
.logo-upload {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.logo-preview {
    width: 150px;
    height: 80px;
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    position: relative;
    overflow: hidden;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    display: none;
}

.logo-preview img[src]:not([src=""]) {
    display: block;
}

#logoPlaceholder {
    color: var(--gray-400);
    font-size: 0.875rem;
}

.logo-preview img:not([src=""]) ~ #logoPlaceholder {
    display: none;
}

.logo-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 테마 선택 */
.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.theme-card {
    cursor: pointer;
    text-align: center;
}

.theme-card input[type="radio"] {
    display: none;
}

.theme-preview {
    width: 100%;
    height: 80px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.theme-preview.light {
    background: white;
}

.theme-preview.dark {
    background: #1a1a1a;
}

.theme-preview.auto {
    background: linear-gradient(90deg, white 50%, #1a1a1a 50%);
}

.preview-header {
    height: 20px;
    background: var(--primary);
}

.theme-preview.dark .preview-header {
    background: #333;
}

.preview-content {
    height: 60px;
    padding: 8px;
}

.theme-card input[type="radio"]:checked + .theme-preview {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.theme-card span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* 색상 팔레트 */
.color-palette {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.color-option {
    cursor: pointer;
    text-align: center;
}

.color-option input[type="radio"] {
    display: none;
}

.color-swatch {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    display: block;
    transition: all 0.2s;
    border: 3px solid transparent;
}

.color-swatch.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
}

.color-swatch.purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.color-swatch.green {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.color-swatch.orange {
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
}

.color-swatch.red {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

.color-option input[type="radio"]:checked + .color-swatch {
    transform: scale(1.1);
    border-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-option span {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* 알림 유형 */
.notification-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-item span {
    font-size: 0.9375rem;
    color: var(--gray-700);
}

/* 로그인 기록 */
.login-history {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 1rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.device {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-900);
}

.location {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.time {
    font-size: 0.8125rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* 백업 섹션 */
.backup-section {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.backup-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item .label {
    font-size: 0.8125rem;
    color: var(--gray-500);
    font-weight: 600;
}

.info-item .value {
    font-size: 1rem;
    color: var(--gray-900);
    font-weight: 700;
}

.backup-actions {
    display: flex;
    gap: 0.75rem;
}

/* 내보내기 섹션 */
.export-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

/* 저장소 정보 */
.storage-info {
    margin-bottom: 1.5rem;
}

.storage-bar {
    width: 100%;
    height: 12px;
    background: var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.storage-used {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 0.5s ease;
}

.storage-details {
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 600;
}

.storage-breakdown {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.storage-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
}

.storage-type {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.storage-size {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* 연동 리스트 */
.integration-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.integration-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 12px;
    transition: all 0.2s;
}

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

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

.integration-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.integration-info h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.integration-info p {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* API 섹션 */
.api-section {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 1.5rem;
}

.api-key {
    margin-bottom: 1rem;
}

.api-key label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.api-key-input {
    display: flex;
    gap: 0.75rem;
}

.api-key-input input {
    flex: 1;
    font-family: 'Courier New', monospace;
}

.api-docs .link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
}

.api-docs .link:hover {
    text-decoration: underline;
}

/* 경고 박스 */
.warning-box {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

/* 시스템 정보 */
.system-info {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 600;
}

.info-row .value {
    font-size: 0.875rem;
    color: var(--gray-900);
    font-weight: 700;
}

.system-actions {
    display: flex;
    gap: 0.75rem;
}

/* 위험 버튼 스타일 */
.btn.danger {
    background: var(--danger);
    color: white;
}

.btn.danger:hover {
    background: #dc2626;
}

.btn-outline.danger {
    border-color: var(--danger);
    color: var(--danger);
}

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

/* 반응형 */
@media (max-width: 1024px) {
    .settings-content {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
    }

    .settings-nav {
        position: static;
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
    }

    .settings-nav-item {
        white-space: nowrap;
        margin-bottom: 0;
        margin-right: 0.5rem;
    }

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

@media (max-width: 640px) {
    .settings-content {
        padding: 1rem;
    }

    .settings-panel {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .notification-types {
        grid-template-columns: 1fr;
    }

    .export-section {
        grid-template-columns: 1fr;
    }

    .storage-breakdown {
        grid-template-columns: 1fr;
    }

    .backup-info {
        grid-template-columns: 1fr;
    }

    .theme-options {
        grid-template-columns: 1fr;
    }

    .color-palette {
        justify-content: center;
    }
}