:root {
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    /* Light theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --glass-bg: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    transition: all 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.brand i {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.theme-toggle i {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 480px auto 320px;
    gap: 2rem;
    align-items: flex-start;
}

/* Form Container */
.form-container, .info-panel-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.form-container:hover, .info-panel-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.input-group label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: -0.25rem;
}

.input-group input,
.input-group select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    width: 100%;
}

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

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.custom-theme-panel {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    gap: 1rem;
}

.custom-theme-panel.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.color-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.color-input-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.color-input-group input[type="color"] {
    height: 40px;
}

input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 50px;
    background-color: transparent;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="color"]::-webkit-color-swatch {
    border-radius: 8px;
    border: none;
}

input[type="color"]::-moz-color-swatch {
    border-radius: 8px;
    border: none;
}

/* Contact Fields */
.contact-field {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.contact-field select {
    flex: 1;
    margin-bottom: 0;
}

.contact-field input {
    flex: 2;
    margin-bottom: 0;
}

.remove-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

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

.btn-secondary:hover {
    background: #059669;
    transform: translateY(-2px);
}

#downloadBtn {
    width: 100%;
    margin-top: 1rem;
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 1.5rem 0;
}

/* Business Card */
.card-preview-area {
    display: flex;
    justify-content: center;
    align-items: center;
}

.card {
    display: grid;
    grid-template-columns: 12px auto;
    width: 380px;
    height: 220px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    --bar-color: #6366f1;
    --primary-font: 'Inter', sans-serif;
    --secondary-font: 'Inter', sans-serif;
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.card[data-theme="light"] {
    --card-bg: #ffffff;
    --name-color-default: #111827;
    --title-color-default: #4b5563;
    --contact-color-default: #374151;
}

.card[data-theme="dark"] {
    --card-bg: #1f2937;
    --name-color-default: #f9fafb;
    --title-color-default: #9ca3af;
    --contact-color-default: #d1d5db;
}

.card[data-theme="custom"] {
    --card-bg: var(--custom-bg-color, #ffffff);
    --name-color-default: var(--custom-primary-text-color, #111827);
    --title-color-default: var(--custom-secondary-text-color, #4b5563);
    --contact-color-default: var(--custom-contact-text-color, #374151);
}

.image-panel {
    background: linear-gradient(135deg, var(--bar-color), rgba(0, 0, 0, 0.2));
    background-blend-mode: multiply;
}

.info-panel {
    position: relative;
    background-color: var(--card-bg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.info-header {
    border-left: 4px solid var(--bar-color);
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 240px;
}

.name {
    color: var(--name-color, var(--name-color-default));
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.2;
    font-family: var(--primary-font);
}

.title, .business {
    color: var(--title-color, var(--title-color-default));
    font-size: 0.9rem;
    font-weight: 400;
    font-family: var(--secondary-font);
}

.contacts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contacts a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--contact-color, var(--contact-color-default));
    font-size: 0.8rem;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-family: var(--secondary-font);
}

.contacts a:hover {
    color: var(--bar-color);
}

.contacts a i {
    color: var(--bar-color);
    font-size: 1rem;
    width: 16px;
    text-align: center;
}

.logo {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 8px;
}

.qr {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Info Panel Container */
.info-panel-container h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-panel-container p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.info-panel-container ul {
    list-style: none;
    padding: 0;
}

.info-panel-container li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.info-panel-container li .fa-solid {
    color: var(--primary-color);
    margin-top: 5px;
}

.ts-control {
    background: var(--bg-secondary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 12px !important;
    padding: 0.75rem !important;
}

.ts-control .item {
    color: var(--text-primary);
}

.ts-dropdown {
    background: var(--bg-primary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 12px !important;
}

.ts-dropdown .option {
    color: var(--text-secondary);
}

.ts-dropdown .option:hover, .ts-dropdown .active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.font-preview {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    text-align: center;
    font-size: 1.2rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.footer-brand {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
    .info-panel-container {
        grid-column: 1 / -1; /* Span full width */
    }
}

@media (max-width: 860px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .card-preview-area {
        order: -1; /* Move card to the top */
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    .theme-toggle {
        top: 1rem;
        right: 1rem;
    }
    .card {
        width: 100%;
        max-width: 380px;
    }
}