/* Premium Custom CSS - Image Storage SPA */

:root {
    --bg-dark: #0a0e1a;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.09);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-hover: rgba(255, 255, 255, 0.2);
    
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --hover-gradient: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #db2777 100%);
    --mint-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --blue-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-glow: #ffffff;
    
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.4);
    
    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 배경 장식 원 */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.4;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: #6366f1;
    top: -100px;
    left: -100px;
}

.circle-2 {
    width: 500px;
    height: 500px;
    background: #db2777;
    bottom: -150px;
    right: -150px;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 헤더 스타일 */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-premium);
    margin-bottom: 30px;
}

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

.logo-icon {
    font-size: 1.8rem;
}

.logo h1 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-tabs {
    display: flex;
    gap: 15px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--text-glow);
    background: var(--primary-gradient);
    box-shadow: var(--shadow-glow);
}

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

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-main);
}

.icon-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
    transform: rotate(30deg);
}

/* 메인 레이아웃 */
.main-content {
    flex-grow: 1;
}

.content-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

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

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

/* 검색바 영역 */
.search-bar-container {
    margin-bottom: 15px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 10px 8px 20px;
    box-shadow: var(--shadow-premium);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-box:focus-within {
    border-color: #818cf8;
    box-shadow: var(--shadow-glow);
}

.search-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-right: 12px;
}

.search-box input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 1.1rem;
    font-family: var(--font-primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* 검색 엔진 선택 세그먼트 컨트롤 탭 */
.engine-tabs-container {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 12px;
    width: fit-content;
}

.engine-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.engine-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}

.engine-tab-btn.active {
    color: var(--text-glow);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.08);
}

.engine-icon {
    font-size: 0.8rem;
}

/* 기본 버튼 스타일 */
.primary-btn {
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    padding: 10px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-glow);
}

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

.secondary-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-weight: 600;
    font-size: 1rem;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--border-color-hover);
}

/* 데모 알림 배너 */
.alert-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 12px 24px;
    border-radius: 14px;
    margin-bottom: 25px;
    backdrop-filter: blur(8px);
}

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

.alert-icon {
    font-size: 1.2rem;
}

.link-btn {
    background: transparent;
    border: none;
    color: #a5b4fc;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.link-btn:hover {
    color: #e0e7ff;
}

/* 벌크 액션바 */
.bulk-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 15px 25px;
    border-radius: 16px;
    margin-bottom: 25px;
    backdrop-filter: blur(8px);
    animation: slideDown 0.3s ease-out;
}

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

.selected-info {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    background: #10b981;
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 800;
}

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

.action-btn.save-btn {
    background: var(--mint-gradient);
    border: none;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.action-btn.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

/* 이미지 그리드 시스템 */
.grid-wrapper {
    min-height: 400px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

/* 빈 상태 표시 */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 20px;
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    opacity: 0.7;
}

.empty-state p {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state .sub-text {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* 이미지 카드 디자인 (Glassmorphism) */
.image-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.image-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-color-hover);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 10px rgba(99, 102, 241, 0.1);
}

.card-img-container {
    position: relative;
    width: 100%;
    padding-top: 66%; /* 3:2 비율 */
    background: #050811;
    overflow: hidden;
}

.card-img-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.image-card:hover .card-img-container img {
    transform: scale(1.05);
}

/* 체크박스 디자인 */
.card-checkbox-wrapper {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
}

.custom-checkbox {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.image-card.selected .custom-checkbox {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.custom-checkbox::after {
    content: "✓";
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    display: none;
}

.image-card.selected .custom-checkbox::after {
    display: block;
}

/* 해상도 뱃지 */
.resolution-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #e0e7ff;
}

.card-details {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

/* 카드 하단 액션 버튼 */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-actions button, .card-actions a {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.card-actions .download-link {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.card-actions .download-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.card-actions .delete-btn {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.card-actions .delete-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
    color: white;
}

/* 갤러리 섹션 헤더 */
.section-header {
    margin-bottom: 25px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px 25px;
    box-shadow: var(--shadow-premium);
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* 모달 오버레이 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 6, 12, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

/* 모달 카드 (Glassmorphism) */
.glass-card {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    width: 90%;
    max-width: 500px;
    overflow-y: auto;
    max-height: 90vh;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e0e7ff;
}

.form-group input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    border-color: #818cf8;
}

.form-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 25px 0;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.help-text a {
    color: #a5b4fc;
    text-decoration: underline;
}

/* API 연결 상태 표시자 */
.api-status-indicator-wrapper {
    margin-top: 20px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.status-item:not(:last-child) {
    margin-bottom: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
}

.status-dot.active {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-dot.inactive {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

.modal-footer {
    padding: 15px 25px 25px 25px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* 토스트 알림 */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 24px;
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 500;
    backdrop-filter: blur(8px);
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(6, 78, 59, 0.9);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(127, 29, 29, 0.9);
}

.toast.info {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(30, 58, 138, 0.9);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.fade-out {
    animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* 로딩 스피너 */
.loading-wrapper {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #818cf8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 푸터 */
.main-footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 40px;
}

/* 숨겨진 뷰 숨기기 */
.hidden {
    display: none !important;
}
