:root {
    --bg-color: #0b0f19;
    --surface-color: #162235;
    --surface-hover: #22314a;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #2e3e5a;
    --success-color: #10b981;
    --font-family: 'Inter', sans-serif;
    --border-radius: 12px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image: radial-gradient(circle at top right, #1e293b, #0b0f19);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.hidden {
    display: none !important;
}

#app-container {
    width: 100%;
    max-width: 480px; /* Mobile width constraint on desktop */
    min-height: 100vh;
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow-x: hidden;
}

.screen {
    padding: 24px 20px;
    width: 100%;
    min-height: 100vh;
    animation: fadeIn 0.3s ease-out;
}

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

/* Onboarding */
.onboarding-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 20%;
}

.logo-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-color);
    margin-bottom: 24px;
}

.onboarding-content h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.onboarding-content p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
    line-height: 1.5;
}

.brands-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.brand-btn {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 18px 20px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-btn:hover, .brand-btn:active {
    background-color: var(--surface-hover);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.app-header h2 {
    font-size: 22px;
    font-weight: 700;
}

.app-header .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.icon-button {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.icon-button:hover, .icon-button:active {
    background: var(--surface-hover);
}

/* Search */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
}

#search-input {
    width: 100%;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px 16px 16px 48px;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: var(--font-family);
    transition: border-color 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Filters */
.filters-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 16px;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.filters-container::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.filter-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Snippets List */
.snippets-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 40px;
}

.snippet-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.snippet-thumbnail {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.snippet-codigo {
    font-weight: 700;
    color: var(--accent-color);
    flex: 0 0 70px;
    font-size: 13px;
    word-break: break-word;
}

.snippet-preview {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    word-break: break-word;
}

.snippet-actions-compact {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit:hover, .btn-edit:active {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}

.btn-send {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.btn-send:hover, .btn-send:active {
    background: var(--accent-hover);
}

.btn-send.sending {
    opacity: 0.7;
    pointer-events: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--success-color);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}
.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
#edit-modal-codigo {
    font-size: 12px;
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
}
.edit-textarea {
    width: 100%;
    height: 200px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 16px;
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
}
.edit-textarea:focus { outline: none; }
.modal-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}
.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:active, .btn-primary:hover {
    background: var(--accent-hover);
}
.btn-primary.sending {
    opacity: 0.7; pointer-events: none;
}

/* Loader */
.loader {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin: 40px auto;
}

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

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}
