/* Reset e configurações base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6b4423;
    --primary-light: #8b5a3c;
    --secondary: #f5deb3;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --text: #333;
    --text-light: #666;
    --bg: #f8f9fa;
    --white: #ffffff;
    --border: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Telas */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Login Screen */
.login-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.logo {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-container h2 {
    color: var(--primary);
    margin-bottom: 2rem;
}

.login-form {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

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

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

.form-group input {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.help-text {
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 1.5rem;
    line-height: 1.8;
}

.link-action {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.link-action:hover {
    text-decoration: underline;
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: #fff5f5;
    border-radius: 6px;
}

/* Header */
.header {
    background: var(--primary);
    color: var(--white);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 1.25rem;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Botão Voltar */
.btn-back {
    background: transparent;
    color: var(--white);
    border: 1px solid var(--white);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

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

/* Botão Pagar */
.btn-pay {
    background: var(--success);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-pay:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

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

/* Estado desabilitado do botão Pagar (futuro) */
.btn-pay:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-pay:disabled:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Refresh Indicator */
.refresh-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--info);
    color: var(--white);
    font-size: 0.875rem;
}

.refresh-indicator.active {
    display: flex;
}

/* Balance Card */
.balance-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 1.5rem;
    margin: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.balance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.balance-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.balance-details {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.balance-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.balance-item span:first-child {
    font-size: 0.875rem;
    opacity: 0.9;
}

.balance-item span:last-child {
    font-size: 1.125rem;
    font-weight: 600;
}

.payment-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.875rem;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--white);
    border-bottom: 2px solid var(--border);
    margin: 0 1rem;
    position: sticky;
    top: 58px;
    z-index: 99;
}

.tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.875rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Content */
.content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Botões */
.btn-primary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

.btn-primary:active {
    background: var(--primary-light);
}

.btn-secondary-large {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

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

.btn-icon,
.btn-icon-small {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    min-width: 48px;
    min-height: 48px;
}

.btn-icon {
    font-size: 1.5rem;
    padding: 0.5rem;
}

.btn-icon-small {
    font-size: 1.25rem;
    padding: 0.25rem;
    opacity: 0.9;
}

/* Lists */
.list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list-item {
    background: var(--white);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
}

.list-item:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.list-item-title {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

.list-item-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.list-item-details {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.6;
}

.list-item-amount {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state p:first-child {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state p:last-child {
    font-size: 1.125rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 1rem;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    min-width: 48px;
    min-height: 48px;
}

.modal-body {
    padding: 1.5rem;
}

.order-info {
    margin-bottom: 1.5rem;
}

.order-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.order-info-row:last-child {
    border-bottom: none;
    font-weight: 600;
    font-size: 1.125rem;
}

.order-items {
    margin-top: 1.5rem;
}

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

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.order-item-name {
    flex: 1;
}

.order-item-qty {
    color: var(--text-light);
    margin: 0 1rem;
}

.order-item-price {
    font-weight: 600;
    color: var(--primary);
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

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

/* Utility classes */
.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--text-light);
}

/* Pull to refresh */
@media (max-height: 600px) {
    .balance-value {
        font-size: 2rem;
    }

    .logo {
        font-size: 2rem;
    }
}

@media (min-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .tabs {
        top: 66px;
    }
}
