:root {
    --primary-color: #393E46;
    --secondary-color: #222831;
    --accent-color: #00ADB5;
    --accent-yellow: #FFD369;
    --neutral-color: #EEEEEE;
    --white: #FFFFFF;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--neutral-color) 0%, #f8f9fa 100%);
    color: var(--primary-color);
    line-height: 1.6;
    padding-bottom: 80px;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 2rem;
}

.welcome-card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.welcome-card p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.primary-btn, .secondary-btn {
    background: var(--accent-color);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.primary-btn:hover {
    background: #008a94;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 173, 181, 0.3);
}

.secondary-btn {
    background: var(--neutral-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

.recent-cards h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.create-header {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.create-header h2 {
    color: var(--primary-color);
}

.template-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.template-selector select {
    padding: 0.5rem;
    border: 2px solid var(--neutral-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--white);
    min-width: 150px;
}

.create-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.form-section, .preview-section {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--neutral-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 173, 181, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.preview-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.card-preview {
    border: 2px dashed var(--neutral-color);
    border-radius: var(--radius);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.preview-placeholder {
    text-align: center;
    color: #999;
}

.preview-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.card-template {
    width: 100%;
    height: 100%;
    min-height: 300px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    border-radius: var(--radius);
}

.card-template.professional {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
}

.card-template.creative {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-yellow) 100%);
    color: var(--primary-color);
}

.card-template.minimal {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--neutral-color);
}

.card-template.corporate {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: var(--white);
}

.card-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.card-company {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.card-contact {
    font-size: 0.8rem;
    line-height: 1.4;
}

.card-contact div {
    margin-bottom: 0.25rem;
}

.qr-container {
    text-align: center;
    padding: 1rem;
    background: var(--neutral-color);
    border-radius: var(--radius);
}

.qr-container.hidden {
    display: none;
}

.qr-container h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

#qr-canvas {
    border: 2px solid var(--white);
    border-radius: var(--radius);
}

.cards-header {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.cards-header h2 {
    color: var(--primary-color);
}

.cards-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

#search-cards {
    padding: 0.5rem;
    border: 2px solid var(--neutral-color);
    border-radius: var(--radius);
    font-size: 1rem;
    min-width: 200px;
}

.card-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-preview-mini {
    height: 150px;
    position: relative;
}

.card-info {
    padding: 1rem;
}

.card-info h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.card-info p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.card-actions {
    padding: 1rem;
    border-top: 1px solid var(--neutral-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.card-actions button {
    background: none;
    border: 1px solid var(--neutral-color);
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--primary-color);
}

.card-actions button:hover {
    background: var(--accent-color);
    color: var(--white);
    border-color: var(--accent-color);
}

.analytics-header {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.analytics-header h2 {
    color: var(--primary-color);
}

.date-filter select {
    padding: 0.5rem;
    border: 2px solid var(--neutral-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--white);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.analytics-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.analytics-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.chart-container {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-placeholder {
    text-align: center;
    color: #999;
}

.chart-placeholder i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.top-cards {
    min-height: 200px;
}

.top-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--neutral-color);
}

.top-card-item:last-child {
    border-bottom: none;
}

.top-card-info h4 {
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.top-card-info p {
    color: #666;
    font-size: 0.9rem;
}

.top-card-stats {
    text-align: right;
}

.top-card-views {
    font-weight: bold;
    color: var(--accent-color);
}

.top-card-scans {
    font-size: 0.9rem;
    color: #666;
}

.faq-section {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.faq-section h2 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--neutral-color);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.5rem 0;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    color: var(--accent-color);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: var(--transition);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 0 1.5rem 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer[aria-hidden="false"] {
    max-height: 200px;
}

.faq-answer p {
    color: #666;
    line-height: 1.6;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--neutral-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #999;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
    min-width: 60px;
}

.nav-item.active {
    color: var(--accent-color);
    background: rgba(0, 173, 181, 0.1);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #666;
    font-size: 0.9rem;
    background: var(--neutral-color);
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .create-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .create-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .cards-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .cards-actions {
        justify-content: center;
    }
    
    .analytics-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .card-actions {
        justify-content: center;
    }
    
    #search-cards {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .welcome-card,
    .form-section,
    .preview-section,
    .analytics-card {
        padding: 1rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--primary-color);
}

.success-message,
.error-message {
    padding: 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    text-align: center;
}

.success-message {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.error-message {
    background: rgba(244, 67, 54, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--neutral-color);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
}

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