/* API Manager Styles - 재활용 가능한 공통 스타일 */

/* 기본 컨테이너 */
.api-container {
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 헤더 영역 */
.api-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.api-header-content h1.api-title {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.api-header-content p.api-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* 버튼 스타일 */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2563eb;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-outline {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

/* 새로운 다운로드 버튼 스타일 */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1d4ed8;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-download:hover {
    background: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.btn-download:active {
    transform: translateY(0);
}

.btn-small {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #374151;
}

.btn-icon.text-danger {
    color: #dc2626;
}

.btn-icon.text-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* 빈 상태 */
.api-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: #fafafa;
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

.api-empty-content {
    text-align: center;
    max-width: 400px;
    padding: 40px 20px;
}

.api-empty-content svg {
    color: #9ca3af;
    margin-bottom: 16px;
}

.api-empty-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.api-empty-content p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* 새로운 간단한 리스트 스타일 */
.api-list-simple {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.api-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
}

.api-item:last-child {
    border-bottom: none;
}

.api-item:hover {
    background: #f9fafb;
}

.api-item-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.api-item-status {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.active {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-indicator.inactive {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.status-text {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #10b981;
}

.status-indicator.inactive + .status-text {
    color: #ef4444;
}

.api-item-details {
    flex: 1;
}

.api-site-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.api-site-url {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 4px 0;
    word-break: break-all;
}

.api-register-date {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
}

.api-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0 24px;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 0 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid #f3f4f6;
    margin-top: 24px;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: white;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:read-only {
    background: #f9fafb;
    color: #6b7280;
}

.form-help {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.4;
}

.input-group {
    display: flex;
    align-items: center;
}

.input-group .form-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-group .btn-icon {
    border: 1px solid #d1d5db;
    border-left: none;
    height: 46px;
    width: 46px;
    background: #f9fafb;
}

.input-group .btn-icon:first-of-type {
    border-radius: 0;
}

.input-group .btn-icon:last-of-type {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.input-group .btn-icon:hover {
    background: #f3f4f6;
}

/* API 키 섹션 */
.api-keys-section {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e2e8f0;
}

/* 로딩 오버레이 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .api-container {
        padding: 16px;
    }
    
    .api-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .api-header-content {
        text-align: center;
    }
    
    .api-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px 20px;
    }
    
    .api-item-info {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .api-item-status {
        align-self: flex-start;
    }
    
    .api-item-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .modal-content {
        margin: 20px;
        max-width: none;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 480px) {
    .api-header-content h1.api-title {
        font-size: 24px;
    }
    
    .api-header-content p.api-subtitle {
        font-size: 14px;
    }
    
    .api-item-actions {
        gap: 6px;
    }
    
    .btn-download,
    .btn-secondary,
    .btn-outline {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .btn-download {
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }
}

/* 알림 및 상태 색상 */
.text-success { color: #10b981; }
.text-warning { color: #f59e0b; }
.text-danger { color: #ef4444; }
.text-info { color: #3b82f6; }

.bg-success { background-color: #d1fae5; }
.bg-warning { background-color: #fef3c7; }
.bg-danger { background-color: #fee2e2; }
.bg-info { background-color: #dbeafe; }

/* 유틸리티 클래스 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 다크모드 지원 (선택사항) */
@media (prefers-color-scheme: dark) {
    .api-container {
        background: #111827;
        color: #f9fafb;
    }
    
    .api-list-simple {
        background: #1f2937;
        border-color: #374151;
    }
    
    .api-item:hover {
        background: #374151;
    }
    
    .modal-content {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .form-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .form-input:read-only {
        background: #111827;
    }
}