/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6B46C1;
    --primary-dark: #553C9A;
    --secondary: #E5E7EB;
    --background: #0F0F23;
    --surface: #1A1A2E;
    --surface-light: #16213E;
    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --border: #374151;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

/* Layout */
#app {
    min-height: 100vh;
    position: relative;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Loading */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--surface);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Auth Screen */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

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

.app-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.app-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    margin-bottom: 2rem;
    background: var(--surface);
    border-radius: 12px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

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

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group input {
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    padding: 16px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--surface-light);
}

.btn-ghost {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.btn-back {
    padding: 8px 12px;
    background: var(--surface);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--surface-light);
}

/* Dashboard */
.app-header-small {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.app-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.app-title .app-icon {
    font-size: 1.5rem;
}

.dashboard-content {
    flex: 1;
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Lists Grid */
.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.list-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.list-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 8px 25px var(--shadow);
}

.list-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

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

.list-name {
    font-weight: 600;
    font-size: 1.1rem;
    flex: 1;
}

.list-menu {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.list-menu:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.list-stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.list-total {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--success);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* FAB */
.fab-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.2s;
}

.fab:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

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

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

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

.modal-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

/* Create Options */
.create-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.create-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    position: relative;
}

.create-option:hover:not(.disabled) {
    border-color: var(--primary);
    background: var(--surface-light);
}

.create-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.option-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

.option-text strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.option-text span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.coming-soon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--warning);
    color: var(--background);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* List Detail Screen */
.list-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.list-header h2 {
    flex: 1;
    font-size: 1.3rem;
}

.list-total {
    background: var(--primary);
    color: white;
    padding: 0.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.total-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.total-value {
    font-size: 2rem;
    font-weight: 700;
}

.list-content {
    flex: 1;
    padding: 0 1rem;
    margin-bottom: 80px; /* Space for add section */
}

/* Items List */
.items-list {
    margin-bottom: 2rem;
}

.item-card {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    transition: all 0.2s;
    min-width: 0; /* Allow content to shrink */
}

.item-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    transition: all 0.2s;
    min-width: 0;
}


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

.item-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.item-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.item-name-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    min-width: 0;
}

.item-name-input:focus {
    outline: none;
    background: var(--surface-light);
}

.item-name-input.checked {
    text-decoration: line-through;
    opacity: 0.6;
}

.item-price-input {
    background: var(--surface-light);
    border: 1px solid var(--border);
    color: var(--success);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    width: 80px;
    text-align: right;
}

.item-price-input:focus {
    outline: none;
    background: var(--background);
    border-color: var(--primary);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: var(--surface-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

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

.btn-icon.camera:hover {
    background: #059669;
}

.btn-icon.voice:hover {
    background: #7C3AED;
}

.btn-icon.delete:hover {
    background: var(--error);
}

/* Add Item Section */
.add-item-section {
    background: var(--surface);
    padding: 1rem;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
}

.add-item-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap; /* Permite que os inputs quebrem para outra linha */
    width: 100%;
}

.form-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    align-items: center;
}

.form-row input {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text-primary);
    font-size: 1rem;
}

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

.form-row input::placeholder {
    color: var(--text-muted);
}

.form-row input[type="text"] {
    flex: 2;
}

.form-row input[type="number"] {
    flex: 1;
}

.btn-add {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}

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

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

/* Add Options Modal */
.add-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.add-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    position: relative;
}

.add-option:hover:not(.disabled) {
    border-color: var(--primary);
    background: var(--surface-light);
}

.add-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error Messages */
.error-message {
    background: var(--error);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
}

/* Success Messages */
.success-message {
    background: var(--success);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
}

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

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}