:root {
    --primary: #1e40af; /* Metallic Blue Deep */
    --primary-light: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    --bg-light: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --pending: #f59e0b;
    --danger: #ef4444;
    --border: #e2e8f0;
    --sidebar-width: 260px;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
    color: var(--text-muted);
}
.upload-area:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.logo-img {
    width: 40px;
    height: 40px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--text-main);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item i {
    width: 20px;
}

.nav-item:hover {
    background: #f8fafc;
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-gradient);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin 0.3s;
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* Cards & Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
}

.stat-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.blue { background: #dbeafe; color: #1e40af; }
.stat-icon.green { background: #dcfce7; color: #15803d; }
.stat-icon.purple { background: #f3e8ff; color: #7e22ce; }
.stat-icon.red { background: #fee2e2; color: #b91c1c; }

/* Buttons */
.quick-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    border: none;
    font-size: 0.95rem;
}

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

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

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-main);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.w-full { width: 100%; justify-content: center; }
.mt-10 { margin-top: 1rem; }
.mt-20 { margin-top: 1.5rem; }

/* Table */
.table-card {
    padding: 0;
    overflow: hidden;
}

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

.view-all {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

/* Badges & Status */
.status-success { color: var(--success); font-weight: 600; }
.status-pending { color: var(--pending); font-weight: 600; }

.badge-pix { background: #e0f2f1; color: #00796b; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }
.badge-crypto { background: #fff3e0; color: #f57c00; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 600; }
.form-control, input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 16px; /* Mínimo 16px para evitar zoom no iOS */
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    max-width: 100%;
}
.form-control:focus { border-color: var(--primary); }
.input-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }

/* Layout specific */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card-header-icon {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

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

.link-info { display: flex; flex-direction: column; }

.content-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Prevenir zoom e overflow em todos os elementos */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

table {
    max-width: 100%;
    table-layout: auto;
}

/* Mobile */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .content-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    .menu-toggle {
        display: block;
    }
    .grid-2-col {
        grid-template-columns: 1fr;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .card {
        padding: 1rem;
    }
    .stat-value {
        font-size: 1.25rem;
    }
    .quick-actions {
        flex-direction: column;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    table {
        font-size: 0.8rem;
    }
    th, td {
        padding: 0.75rem 0.5rem;
    }
}

/* Mobile pequeno - evitar zoom automático */
@media (max-width: 480px) {
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    body {
        font-size: 16px;
        -webkit-font-smoothing: antialiased;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important; /* Evita zoom automático no iOS */
        -webkit-appearance: none;
        border-radius: 0.5rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .top-bar {
        margin-bottom: 1rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 100%;
        font-size: 0.75rem;
        width: 100%;
        max-width: 100%;
    }
    
    th, td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .app-container {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .card {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
}