:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary: #ec4899;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --success: #10b981;
    --border: #e5e7eb;
}

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

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

.hidden {
    display: none !important;
}

/* ========================================
   LOGIN SCREEN
======================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1rem;
}

.login-container {
    background: white;
    border-radius: 24px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.logo-circle i {
    font-size: 2.5rem;
    color: white;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
}

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

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

.form-group label i {
    margin-right: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

/* ========================================
   APP CONTAINER
======================================== */
.app-container {
    min-height: 100vh;
    background: var(--bg);
    padding-bottom: 80px;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.header-logo i {
    font-size: 1.5rem;
}

.header-logo span {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.header-user span {
    font-weight: 500;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
    border-color: white;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 100;
}

.nav-btn {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s;
    border-radius: 12px;
}

.nav-btn i {
    font-size: 1.25rem;
}

.nav-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-btn.active {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* ========================================
   EMPRESAS
======================================== */
.empresas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.empresas-header h2 {
    font-size: 1.5rem;
    color: var(--text);
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
}

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

.empresa-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.empresa-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.empresa-header {
    padding: 1rem;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.empresa-logo {
    width: 150px !important;
    height: 150px !important;
    object-fit: contain !important;
    border-radius: 12px;
    background: white;
    padding: 8px;
}

.empresa-body {
    padding: 1rem;
}

.empresa-nome {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.desconto-badge {
    display: inline-block;
    background: var(--success);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.empresa-categoria,
.empresa-endereco,
.empresa-telefone {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========================================
   CARTEIRINHA
======================================== */
.carteirinha {
    max-width: 400px;
    margin: 0 auto;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.3);
    color: white;
}

.carteirinha-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.carteirinha-logo {
    text-align: left;
}

.carteirinha-logo i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.carteirinha-logo h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.carteirinha-foto-wrapper {
    position: relative;
}

.carteirinha-foto,
.carteirinha-foto-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    background: rgba(255,255,255,0.2);
    object-fit: cover;
}

.carteirinha-foto-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
}

.foto-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.foto-upload-btn:hover {
    transform: scale(1.1);
}

.carteirinha-info {
    margin-bottom: 2rem;
    text-align: center;
}

.carteirinha-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.carteirinha-info p {
    font-size: 1rem;
    opacity: 0.9;
}

.carteirinha-qr {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
}

.carteirinha-qr #qrCode {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.carteirinha-qr p {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* ========================================
   VALIDAR
======================================== */
.validar-content {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.validar-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

.btn-scan {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-scan:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

#qr-reader {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

#qr-result {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

.validation-success {
    color: var(--success);
}

.validation-success i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.validation-error {
    color: #ef4444;
}

.validation-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 768px) {
    .empresas-list {
        grid-template-columns: 1fr;
    }
    
    .header-user span {
        display: none;
    }
}
