* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #a5215d;
    --primary-dark: #8a1a4d;
    --dark-color: #1f2937;
    --light-color: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #a5215d;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    transition: margin-left 0.3s ease;
}

/* Modern Navigation */
.navbar {
    background: var(--light-color);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: var(--shadow-sm);
}

.navbar .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    color: var(--gray-900);
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.navbar-brand i {
    color: var(--primary-color);
}

/* Hamburger Menu */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.navbar-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--gray-700);
    border-radius: 2px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.navbar-toggle.active span:first-child {
    transform: rotate(45deg);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-left: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.25rem 0;
    font-size: 0.875rem;
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--gray-300);
    margin: 0 1rem;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--light-color);
    border-right: 1px solid var(--gray-200);
    z-index: 1001;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.sidebar.active {
    left: 0;
}

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

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0.25rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background-color: var(--gray-100);
    color: var(--gray-700);
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-item {
    margin: 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-700);
    transition: all 0.2s ease;
    border-radius: 0;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background-color: var(--gray-50);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background-color: var(--gray-100);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

/* User Menu */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid var(--gray-200);
    background-color: var(--gray-50);
}

.user-menu:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-300);
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--gray-500);
    transition: transform 0.2s ease;
}

.user-menu.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-menu.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-color);
    font-weight: 600;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.user-name {
    font-size: 0.813rem;
    font-weight: 500;
    color: var(--gray-900);
    white-space: nowrap;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--light-color);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10000;
    pointer-events: none;
}

.user-menu.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: var(--light-color);
    border: 1px solid var(--gray-200);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
    z-index: 1;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--gray-50);
    color: var(--primary-color);
    text-decoration: none;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--gray-500);
}

.dropdown-item:hover i {
    color: var(--primary-color);
}

/* Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main content */
.main-content {
    min-height: calc(100vh - 60px);
    transition: margin-left 0.3s ease;
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Cards - Design minimalista */
.card {
    background: var(--light-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: var(--gray-50);
    color: var(--gray-900);
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header i {
    color: var(--primary-color);
}

.card-body {
    padding: 1.5rem;
}

/* Formulários */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-medium);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(165, 33, 93, 0.1);
}

/* Botões - Design minimalista */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

.btn:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--primary-color);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--light-color);
    text-decoration: none;
}

.btn-success {
    background: var(--success-color);
    color: var(--light-color);
    border-color: var(--success-color);
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
    color: var(--light-color);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--light-color);
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: var(--light-color);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--gray-900);
    border-color: var(--warning-color);
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: var(--light-color);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

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

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: var(--light-color);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.btn-outline-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    min-height: 32px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Tabelas */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-medium);
}

.table th {
    background-color: var(--gray-light);
    font-weight: 600;
    color: var(--dark-color);
}

.table tr:hover {
    background-color: rgba(165, 33, 93, 0.05);
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    text-transform: none;
    letter-spacing: normal;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-danger {
    background-color: #fecaca;
    color: #991b1b;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

/* Utilities */
.text-primary { color: var(--primary-color) !important; }
.text-gray-600 { color: var(--gray-600) !important; }
.text-gray-500 { color: var(--gray-500) !important; }
.text-gray-400 { color: var(--gray-400) !important; }

.bg-gray-50 { background-color: var(--gray-50) !important; }
.bg-gray-100 { background-color: var(--gray-100) !important; }

.h3 { 
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 2.25rem;
}

.mb-1 { margin-bottom: 0.25rem !important; }
.mb-0 { margin-bottom: 0 !important; }

/* QR Code */
.qr-code-container {
    text-align: center;
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
    border: 2px dashed var(--gray-300);
}

.qr-code-image {
    max-width: 280px;
    width: 100%;
    height: auto;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Improved Form Elements */
.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: var(--light-color);
}

.form-control:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background-color: var(--gray-50);
    color: var(--gray-500);
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-append {
    display: flex;
}

.input-group-append .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
}

/* Footer */
.footer {
    background-color: var(--dark-color);
    color: var(--light-color);
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .navbar-toggle {
        display: flex;
    }
    
    .navbar-nav {
        display: none;
    }
    
    .container {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn:last-child {
        margin-bottom: 0;
    }
    
    .row .col-md-6 .btn {
        width: auto;
        margin-bottom: 0;
        margin-right: 0.5rem;
    }
}

@media (max-width: 992px) and (min-width: 769px) {
    .user-name {
        display: none;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .user-menu {
        padding: 0.5rem;
    }
}

@media (min-width: 769px) {
    .sidebar {
        display: none;
    }
    
    .navbar-nav {
        display: flex !important;
    }
}

/* Login page específico */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    padding: 1rem;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--light-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.login-header {
    background: linear-gradient(135deg, var(--gray-900), var(--gray-800));
    color: var(--light-color);
    text-align: center;
    padding: 2rem;
}

.login-header h1 {
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.login-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.875rem;
}

.login-body {
    padding: 2rem;
}

/* Toast notifications positioning */
.toast-notification {
    position: fixed !important;
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 10000 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
}

/* Ensure toasts are visible on login page */
.login-container .toast-notification {
    z-index: 10001 !important;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.w-100 {
    width: 100%;
}