/* ===================================
   Pamphlet Generator - Main Styles
   =================================== */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #48bb78;
    --warning: #ed8936;
    --danger: #f56565;
    --info: #4299e1;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-700);
}

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

.logo-icon { font-size: 28px; }
.logo-text { font-size: 20px; font-weight: 700; }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--gray-800);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.nav-icon { font-size: 18px; }
.nav-text { font-size: 15px; font-weight: 500; }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-700);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.user-icon { font-size: 20px; }
.user-name { font-size: 14px; color: var(--gray-300); }

.btn-logout {
    width: 100%;
    padding: 10px;
    background: var(--gray-800);
    border: none;
    border-radius: 8px;
    color: var(--gray-300);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--gray-700);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-wrapper {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.page-header p {
    color: var(--gray-500);
    font-size: 15px;
}

.header-left { display: flex; flex-direction: column; gap: 4px; }
.header-right { display: flex; gap: 12px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

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

.btn-danger { background: var(--danger); color: white; }
.btn-text { background: none; color: var(--primary); }
.btn-text:hover { text-decoration: underline; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { padding: 8px; }
.btn-full { width: 100%; justify-content: center; }
.btn-back { background: none; color: var(--gray-600); padding: 0; margin-bottom: 8px; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon { font-size: 40px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 14px; color: var(--gray-500); }

/* Content Section */
.content-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* Pamphlet List */
.pamphlet-list { display: flex; flex-direction: column; gap: 12px; }

.pamphlet-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.pamphlet-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-100);
    flex-shrink: 0;
}

.pamphlet-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--gray-400);
}

.pamphlet-info { flex: 1; }
.pamphlet-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.pamphlet-info p { font-size: 14px; color: var(--gray-500); }

.pamphlet-meta {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 13px;
}

/* Status Badges */
.status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-draft { background: var(--gray-200); color: var(--gray-600); }
.status-generating { background: #fef3c7; color: #d97706; }
.status-completed { background: #d1fae5; color: #059669; }
.status-failed { background: #fee2e2; color: #dc2626; }

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.action-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

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

.action-icon { font-size: 36px; }
.action-content h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.action-content p { font-size: 14px; color: var(--gray-500); }

/* Forms */
.form-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.form-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

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

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

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    gap: 20px;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
}

.required { color: var(--danger); }
.help-text { font-size: 13px; color: var(--gray-500); margin-top: 6px; }

/* Pamphlet Grid */
.pamphlet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.pamphlet-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

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

.card-thumbnail {
    height: 180px;
    background: var(--gray-100);
    position: relative;
    cursor: pointer;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
}

.card-content {
    padding: 16px;
}

.card-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    cursor: pointer;
}

.card-content h3:hover { color: var(--primary); }

.business-name, .template-type {
    font-size: 14px;
    color: var(--gray-500);
}

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

.card-actions { display: flex; gap: 4px; }

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.search-box {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
}

.filter-group select {
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.btn-page {
    padding: 8px 14px;
    border: 1px solid var(--gray-200);
    background: white;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

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

.page-dots { padding: 8px; color: var(--gray-400); }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-state.full-width { grid-column: 1 / -1; }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--gray-700); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
}

.loading-overlay.active { display: flex; }

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-message {
    color: white;
    margin-top: 16px;
    font-size: 16px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--gray-800);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1001;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

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

/* Loading Placeholder */
.loading-placeholder {
    padding: 40px;
    text-align: center;
    color: var(--gray-400);
}

/* Features List */
.features-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-item {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
}

.feature-item input {
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
}

/* Color Preview */
.color-preview {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--gray-200);
}

/* Settings */
.settings-container {
    max-width: 800px;
}

.settings-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.settings-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button input { flex: 1; }

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: 8px;
    margin-bottom: 20px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-400);
}

.status-indicator.success { background: var(--success); }
.status-indicator.warning { background: var(--warning); }

.stats-grid.small .stat-card { padding: 16px; }
.stats-grid.small .stat-value { font-size: 20px; }

/* Responsive */
@media (max-width: 1024px) {
    .form-row.two-columns,
    .form-row.three-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    .page-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .header-right {
        width: 100%;
    }
}
