@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --bg: #f0f2f5;
    --white: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #65676b;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #27ae60;
    --blue: #3498db;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 80px;
}

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

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

.header h1 {
    font-size: 1.125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.status-badge.connected { background: #d4edda; color: #155724; }
.status-badge.disconnected { background: #f8d7da; color: #721c24; }

.nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-item.active {
    color: var(--primary);
    background: rgba(37, 211, 102, 0.1);
}

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

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

.fab {
    position: fixed;
    bottom: 90px;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    transition: transform 0.2s;
}

.fab:active { transform: scale(0.95); }
.fab.blue { background: var(--blue); }

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

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

.card-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn {
    flex: 1;
    min-width: 70px;
    padding: 0.6rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:active { transform: scale(0.95); }

.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--bg); color: var(--text); }
.btn-danger { background: #fdeaea; color: var(--danger); }
.btn-warning { background: #fff8e6; color: var(--warning); }
.btn-full { width: 100%; }

.btn-large {
    padding: 0.875rem;
    font-size: 0.875rem;
}

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

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--white);
}

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

.form-file {
    border: 2px dashed #ddd;
    padding: 2rem 1rem;
    text-align: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.form-file:hover { border-color: var(--primary); background: rgba(37,211,102,0.05); }

.form-file i {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-info { background: #d1ecf1; color: #0c5460; }

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--white);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: var(--bg);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-actions .btn { padding: 0.875rem; }

.list-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
}

.list-item-content { flex: 1; }
.list-item-title { font-weight: 600; margin-bottom: 0.25rem; }
.list-item-subtitle { font-size: 0.8rem; color: var(--text-secondary); }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

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

.progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.3s;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.stat-item {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.25rem; }

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.qr-image {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
}

.qr-image img {
    display: block;
    max-width: 280px;
    width: 100%;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.checkbox-item input {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
}

.checkbox-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-bar {
    position: relative;
    margin-bottom: 1rem;
}

.search-bar input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.5rem;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

@media (min-width: 600px) {
    body { padding-bottom: 0; }
    .nav { position: relative; margin-top: 2rem; }
    .fab { display: none; }
    .container { padding: 2rem 0; }
}