/* ============================================
   SmartFig — Global Styles
   ============================================ */

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1a1d23;
    --sidebar-text: #a0a4b0;
    --sidebar-active: #4f8cff;
    --sidebar-hover: #2a2d35;
    --bg-primary: #f5f6f8;
    --bg-white: #ffffff;
    --text-primary: #1a1d23;
    --text-secondary: #6b7280;
    --border-color: #e2e5ea;
    --accent: #4f8cff;
    --accent-hover: #3a7aef;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.12);
    --transition: 0.2s ease;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.5;
}

/* ---- Layout ---- */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

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

.sidebar-logo {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    color: var(--accent);
    font-size: 20px;
}

.sidebar-version {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition);
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active {
    color: #fff;
    background: rgba(79, 140, 255, 0.12);
    border-right: 3px solid var(--sidebar-active);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user-name {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.sidebar-logout-btn:hover {
    color: var(--danger);
    background: rgba(255, 255, 255, 0.06);
}

/* ---- Main content ---- */

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

.content-header {
    padding: 16px 24px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-primary);
}

.page-title {
    font-size: 18px;
    font-weight: 600;
}

.content-body {
    padding: 24px;
}

/* ---- Cards ---- */

.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

/* ---- Grid ---- */

.grid {
    display: grid;
    gap: 20px;
}

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

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

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

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

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

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* ---- Forms ---- */

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

.form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.12);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: var(--font-mono);
}

/* ---- Tables ---- */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--bg-primary);
}

.table tr:hover td {
    background: rgba(79, 140, 255, 0.03);
}

/* ---- Badges ---- */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-draft { background: #fef3c7; color: #92400e; }
.badge-converted { background: #dbeafe; color: #1e40af; }
.badge-exported { background: #dcfce7; color: #166534; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-failed { background: #fde2e2; color: #991b1b; }
.badge-pending { background: #f3f4f6; color: #374151; }

/* Source type badges */
.badge-source-json { background: #ede9fe; color: #5b21b6; }
.badge-source-svg { background: #fce7f3; color: #9d174d; }
.badge-source-figma_api { background: #ede9fe; color: #5b21b6; }
.badge-source-gemini { background: #ecfdf5; color: #065f46; }
.badge-source-elementor { background: #fef3c7; color: #92400e; }
.badge-elementor { background: #fef3c7; color: #92400e; }
.badge-figma { background: #ede9fe; color: #5b21b6; }

/* ---- Stats ---- */

.stat-card {
    text-align: center;
    padding: 24px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

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

/* ---- Notifications ---- */

.notifications {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    padding: 12px 20px;
    border-radius: var(--radius);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.notification-success { border-left: 4px solid var(--success); }
.notification-error { border-left: 4px solid var(--danger); }
.notification-info { border-left: 4px solid var(--accent); }

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

/* ---- Empty state ---- */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

/* ---- Utilities ---- */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.text-right { text-align: right; }
.hidden { display: none !important; }

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}
