/**
 * CardMaker Designer - Main Styles
 */

/* ========================================
   Variables
   ======================================== */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    
    --bg: #f3f4f6;
    --bg-dark: #e5e7eb;
    --surface: #ffffff;
    --border: #e5e7eb;
    
    --header-height: 56px;
    --sidebar-width: 280px;
    
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 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);
    
    --transition: 150ms ease;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
}

/* ========================================
   Header
   ======================================== */
.designer-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
}

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

.logo-text {
    font-size: 1.125rem;
}

/* Mode Switcher */
.mode-switcher {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 4px;
    margin-left: 16px;
}

.mode-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

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

.mode-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    padding: 4px 8px;
    border-radius: var(--radius);
}

.zoom-level {
    font-size: 13px;
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

/* Tool Buttons */
.tool-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: var(--bg);
}

.tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

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

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

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

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

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

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

.w-full {
    width: 100%;
}

.mb-2 {
    margin-bottom: 8px;
}

/* ========================================
   Main Layout
   ======================================== */
.designer-main {
    display: flex;
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
}

/* ========================================
   Sidebars
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid var(--border);
}

.sidebar-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Background Presets */
.bg-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.bg-preset {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
}

.bg-preset:hover {
    transform: scale(1.05);
}

.bg-preset.active {
    border-color: var(--primary);
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.template-item {
    aspect-ratio: 1.586; /* Business card ratio */
    background: var(--bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    overflow: hidden;
    transition: all var(--transition);
}

.template-item:hover {
    border-color: var(--primary-light);
}

/* ========================================
   Forms in Sidebar
   ======================================== */
.form-select,
.form-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 4px;
}

.form-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

/* QR Section */
.qr-type-selector {
    margin-bottom: 12px;
}

.qr-fields .form-input {
    margin-bottom: 8px;
}

.qr-preview {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.qr-placeholder {
    color: var(--text-light);
    font-size: 12px;
}

/* Layers */
.layers-list {
    max-height: 200px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition);
}

.layer-item:hover {
    background: var(--bg);
}

.layer-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.layer-item.empty {
    color: var(--text-light);
    cursor: default;
}

.layer-item.empty:hover {
    background: transparent;
}

/* ========================================
   Utilities
   ======================================== */
.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1200px) {
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 900px) {
    .sidebar-left {
        display: none;
    }
    
    .sidebar-right {
        width: 280px;
    }
}

@media (max-width: 700px) {
    .sidebar-right {
        display: none;
    }
    
    .header-center {
        display: none;
    }
    
    .mode-switcher {
        display: none;
    }
}
