/* V3 Pagamentos - Modern Dashboard Styles */

:root {
    /* V3Pay Brand Colors */
    --primary-color: #667eea;
    --primary-hover: #5568d3;
    --primary-light: #8b9cff;
    --secondary-color: #4facfe;
    --secondary-dark: #3d8fd1;
    --secondary-light: #7ec8ff;

    /* Status Colors */
    --success-color: #48bb78;
    --error-color: #f56565;
    --warning-color: #ed8936;
    --info-color: #4299e1;

    /* Neutral Colors */
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;

    /* Sidebar - Elegant Dark Gray */
    --sidebar-bg: #2d3748;
    --sidebar-hover: rgba(102, 126, 234, 0.1);
    --sidebar-active: rgba(102, 126, 234, 0.15);

    /* Shadows */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 16.25rem;
    /* 260px converted to rem for zoom responsiveness */
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 1000;
    left: 0;
    top: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar.active {
    z-index: 1001;
    /* Above overlay when active */
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 0 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
    border-left-color: var(--primary-color);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: white;
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    opacity: 0.8;
}

.nav-item-text {
    font-size: 14px;
    font-weight: 500;
}

.nav-item-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--primary-color);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 16.25rem;
    /* Match sidebar width */
    padding: 1.5rem;
    transition: margin-left 0.3s ease;
}

/* Top Bar */
.top-bar {
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.top-bar-left p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Menu Toggle Button */
.menu-toggle {
    display: flex;
    /* Changed from 'none' to always show button */
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    position: relative;
}

.menu-toggle span {
    width: 2rem;
    height: 0.25rem;
    background: var(--text-primary);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.menu-toggle:hover span {
    background: var(--primary-color);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.top-bar-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu:hover {
    background: var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-change {
    font-size: 13px;
    margin-top: 8px;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--error-color);
}

/* Card */
.card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #4facfe 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #3d8fd1 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background-color: var(--bg-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

table td {
    font-size: 14px;
    color: var(--text-primary);
}

table tr:hover {
    background-color: var(--bg-color);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
}

/* Alert */
.alert {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #065f46;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

/* Responsive Design */

/* Extra Large Desktop - 1400px and up (handles zoom out or very large screens) */
@media (min-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large Desktop - 1200px to 1399px (also catches 150% zoom on 1920px screens) */
@media (max-width: 1399px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    }
}

/* Medium Desktop - 1100px to 1199px (catches 125% zoom or smaller desktops) */
@media (max-width: 1199px) {
    .sidebar {
        width: 15rem;
        /* Slightly narrower */
    }

    .main-content {
        margin-left: 15rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    }

    .stat-value {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }

    .top-bar-left h1 {
        font-size: clamp(1.25rem, 3vw, 1.5rem);
    }
}

/* Desktop - 900px to 1099px (catches 150% zoom on smaller screens) */
@media (max-width: 1099px) {
    .sidebar {
        width: 13.75rem;
        /* 220px */
    }

    .main-content {
        margin-left: 13.75rem;
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .card {
        padding: 1.25rem;
    }

    .top-bar {
        padding: 0.875rem 1.25rem;
        flex-wrap: wrap;
    }

    .top-bar-left h1 {
        font-size: 1.25rem;
    }

    .top-bar-left p {
        font-size: 0.8125rem;
    }

    table th,
    table td {
        padding: 0.75rem 0.875rem;
        font-size: 0.8125rem;
    }
}

/* Tablet - 768px to 899px (mobile landscape or high zoom) */
@media (max-width: 899px) {

    /* Show menu toggle button */
    .menu-toggle {
        display: flex;
    }

    .sidebar {
        width: 13.75rem;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .card {
        padding: 1.25rem;
        max-width: 100%;
        overflow-x: auto;
    }

    .top-bar {
        padding: 0.875rem 1.25rem;
        flex-wrap: wrap;
    }

    .top-bar-left {
        flex: 1;
        min-width: 0;
    }

    .top-bar-left h1 {
        font-size: 1.25rem;
    }

    .top-bar-left p {
        font-size: 0.8125rem;
    }

    table th,
    table td {
        padding: 0.75rem 0.875rem;
        font-size: 0.8125rem;
    }
}

/* Mobile - 768px and below */
@media (max-width: 768px) {

    /* Show menu toggle button */
    .menu-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 16.25rem;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .main-content {
        margin-left: 0;
        padding: 12px;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .top-bar {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        padding: 12px 16px;
    }

    .top-bar-left {
        width: 100%;
    }

    .top-bar-right {
        width: 100%;
    }

    .user-menu {
        width: 100%;
        justify-content: space-between;
    }

    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .card-actions {
        width: 100%;
        flex-direction: column;
    }

    .card-actions .btn {
        width: 100%;
    }

    /* Make tables scrollable on mobile */
    .card>table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Small Mobile - 576px and below */
@media (max-width: 576px) {
    .main-content {
        padding: 8px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-title {
        font-size: 11px;
    }

    .card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .card-header h2 {
        font-size: 16px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .auth-card {
        padding: 24px;
        margin: 20px auto;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }
}

/* Auth Pages (keep existing styles) */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.auth-card {
    max-width: 500px;
    margin: 50px auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* 2FA Setup */
.setup-2fa h3 {
    margin-top: 30px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 18px;
}

.qr-code-container {
    text-align: center;
    padding: 20px;
    background-color: var(--bg-color);
    border-radius: 8px;
    margin: 15px 0;
    overflow: visible;
}

.qr-code-container img {
    width: 300px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.backup-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.backup-codes code {
    display: block;
    padding: 10px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.api-credentials {
    margin: 15px 0;
}

.credential-item {
    margin-bottom: 15px;
    padding: 15px;
    background-color: var(--bg-color);
    border-radius: 8px;
}

.credential-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}

.credential-item code {
    display: inline-block;
    padding: 8px 12px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
}

.btn-copy {
    padding: 6px 12px;
    font-size: 12px;
    margin-left: 10px;
}

.success-message {
    text-align: center;
    padding: 20px;
    background-color: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    margin-bottom: 30px;
}

.success-message h2 {
    color: var(--success-color);
    margin-bottom: 10px;
}