/* Dark Theme (default) */
:root, [data-theme="dark"] {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --success: #2ec4b6;
    --danger: #ef233c;
    --warning: #ffbe0b;
    --info: #00b4d8;
    --dark: #121212;
    --dark-accent: #1e1e1e;
    --light: #f8f9fa;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --border: #333333;
    --input-bg: #2a2a2a;
    --th-bg: #252525;
    --hover-bg: rgba(255, 255, 255, 0.03);
}

/* Light Theme */
[data-theme="light"] {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --info: #0284c7;
    --dark: #ffffff;
    --dark-accent: #f8fafc;
    --light: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --input-bg: #ffffff;
    --th-bg: #f1f5f9;
    --hover-bg: rgba(0, 0, 0, 0.03);
}

/* Light theme login page adjustments */
[data-theme="light"] body {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #bae6fd 100%);
}

[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .form-control {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .shape-1,
[data-theme="light"] .shape-2 {
    opacity: 0.15;
}

/* Blue Theme */
[data-theme="blue"] {
    --primary: #0ea5e9;
    --secondary: #0284c7;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --dark: #0c4a6e;
    --dark-accent: #075985;
    --light: #f0f9ff;
    --text-main: #e0f2fe;
    --text-muted: #bae6fd;
    --border: #0369a1;
    --input-bg: #0e7490;
    --th-bg: #164e63;
    --hover-bg: rgba(255, 255, 255, 0.05);
}

/* Purple Theme */
[data-theme="purple"] {
    --primary: #a855f7;
    --secondary: #9333ea;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #8b5cf6;
    --dark: #581c87;
    --dark-accent: #6b21a8;
    --light: #faf5ff;
    --text-main: #f3e8ff;
    --text-muted: #e9d5ff;
    --border: #7e22ce;
    --input-bg: #7c3aed;
    --th-bg: #6b21a8;
    --hover-bg: rgba(255, 255, 255, 0.05);
}

/* Green Theme */
[data-theme="green"] {
    --primary: #10b981;
    --secondary: #059669;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #14b8a6;
    --dark: #064e3b;
    --dark-accent: #065f46;
    --light: #f0fdf4;
    --text-main: #d1fae5;
    --text-muted: #a7f3d0;
    --border: #047857;
    --input-bg: #059669;
    --th-bg: #047857;
    --hover-bg: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--dark);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    width: min(98vw, 2400px);
    max-width: 2400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.table-container {
    width: 100%;
}

@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 1rem;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary), var(--info));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.actions {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.btn i {
    font-size: 0.9rem;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
}

.btn-sm i {
    font-size: 0.75rem;
}

.btn-sm:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-sm-danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
}

.btn-sm-danger:hover {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary);
    transform: translateY(-2px);
}

/* Icon size normalization */
i.fas, i.far, i.fab {
    font-size: inherit;
    line-height: 1;
}

.table-container {
    /* Limita a visualização a ~15 linhas com rolagem vertical */
    max-height: 650px;
    overflow-y: auto;
    overflow-x: auto;
    background: var(--dark-accent);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--th-bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

th.sortable-column {
    min-width: 120px;
}

.th-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: none;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.sort-indicator {
    position: relative;
    width: 0.8rem;
    height: 0.9rem;
    flex-shrink: 0;
}

.sort-indicator::before,
.sort-indicator::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.35;
}

.sort-indicator::before {
    top: 0;
    border-bottom: 5px solid currentColor;
}

.sort-indicator::after {
    bottom: 0;
    border-top: 5px solid currentColor;
}

th.sortable-column.is-sorted {
    color: var(--text-main);
}

th.sortable-column.sort-asc .sort-indicator::before,
th.sortable-column.sort-desc .sort-indicator::after {
    opacity: 1;
    color: var(--primary);
}

tr:hover {
    background-color: var(--hover-bg);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-concluida {
    background-color: rgba(46, 196, 182, 0.2);
    color: var(--success);
    border: 1px solid rgba(46, 196, 182, 0.3);
}

.status-cancelada {
    background-color: rgba(239, 35, 60, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 35, 60, 0.3);
}

.status-liberacao {
    background-color: rgba(255, 190, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(255, 190, 11, 0.3);
}

.status-revisada {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--dark-accent);
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    border: 1px solid var(--border);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background-color: var(--input-bg);
    color: var(--text-main);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.filter-row input {
    width: 100%;
    padding: 0.4rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.filter-row input:focus {
    border-color: var(--primary);
    color: var(--text-main);
    outline: none;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark);
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Theme Selector Styles */
.theme-selector {
    position: relative;
}

.theme-button {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.theme-button i {
    font-size: 1.2rem;
}

.theme-button:hover {
    background: var(--hover-bg);
    color: var(--primary);
    transform: scale(1.1);
}

.theme-button span {
    display: none;
}

.theme-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--dark-accent);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-dropdown.active {
    display: block;
}

.theme-option {
    padding: 0.85rem 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
    color: var(--text-main);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
}

.theme-option:last-child {
    border-bottom: none;
}

.theme-option:hover {
    background: var(--hover-bg);
    padding-left: 1.5rem;
}

.theme-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.theme-option span {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    font-size: 0.9rem;
}

.theme-option span i {
    font-size: 0.9rem;
}

.theme-option.active {
    background: rgba(67, 97, 238, 0.15);
    color: var(--primary);
    font-weight: 600;
}

.theme-option.active .theme-color {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}