:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
}

/* Layout Wrapper */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #0f172a;
    color: white;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.main-area {
    flex: 1;
    margin-left: 260px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: 70px;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2.5rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.sidebar-logo {
    margin-bottom: 3rem;
}

.sidebar-logo img {
    height: 32px;
    filter: brightness(0) invert(1);
    display: block;
}

.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #94a3b8;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem;
    flex: 1;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: none;
    /* Desativado em favor da sidebar */
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.logo img {
    height: 32px;
}

/* Cards & Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.qr-preview {
    width: 64px;
    height: 64px;
    background: #f8fafc;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
}

.qr-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12%;
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.card-body {
    flex: 1;
}

/* Typography */
h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.025em;
}

h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
}

.badge {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.65rem;
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    margin-top: 0.25rem;
}

.url-text {
    font-size: 0.75rem;
    color: #94a3b8;
    word-break: break-all;
    margin: 0.75rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f1f5f9;
}

/* Forms */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2.5rem;
    max-width: 600px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #334155;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.625rem;
    border: 1px solid var(--border);
    font-family: inherit;
    transition: all 0.2s;
    background: #fbfcfe;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background: white;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: block;
}

.alert-info {
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px dashed var(--border);
}

/* Utils */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-danger {
    color: #ef4444;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e2e8f0;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #10b981;
}

input:checked+.slider:before {
    transform: translateX(14px);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-muted);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f8fafc;
    color: var(--primary);
    border-color: var(--primary);
}

/* Chart */
.chart-container {
    background: white;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    height: 300px;
}

/* Templates Selector */
.template-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.template-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    border: 2px solid #f1f5f9;
    border-radius: 0.75rem;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
    text-align: center;
}

.template-option svg {
    margin-bottom: 0.5rem;
    color: #94a3b8;
}

.template-option span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.template-option:hover {
    border-color: #cbd5e1;
}

.template-option.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.template-option.active svg {
    color: var(--primary);
}

.template-option.active span {
    color: var(--primary);
}

/* Modal Customizado (Premium) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    text-align: center;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-icon {
    width: 64px;
    height: 64px;
    background: #fff7ed;
    color: #f97316;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.modal-body {
    font-size: 0.9375rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
}

.modal-footer button {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-modal-cancel {
    background: #f1f5f9;
    border: none;
    color: #64748b;
}

.btn-modal-confirm {
    background: #0f172a;
    border: none;
    color: white;
}

.btn-modal-confirm:hover {
    background: #1e293b;
    transform: translateY(-1px);
}

.grid>div {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Dashboard Components Refined */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-card .label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
}

/* Search Bar */
.search-container {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 1rem center;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}