/* TS Informática - Backoffice Styles */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark Mode */
html.dark-theme,
body.dark-theme,
html.dark-theme :root,
body.dark-theme :root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #94a3b8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

* {
    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;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 20px;
}

/* Ensure main content area has proper spacing */
.main-content-wrapper > main {
    padding: 1.5rem;
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease, width 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-header .sidebar-logo {
    display: none;
}

.sidebar.collapsed .sidebar-header .sidebar-logo .logo-text,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-category-title,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-search input {
    opacity: 0;
    width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-search {
    padding: 0.5rem;
    justify-content: center;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .user-profile .user-info {
    display: none;
}

.sidebar.collapsed .btn-logout span {
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    min-height: 70px;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.25rem 0.5rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.sidebar-logo img {
    max-height: 40px;
    max-width: 150px;
    object-fit: contain;
}

.sidebar-logo .logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* Sidebar Search */
.sidebar-search-wrapper {
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search {
    padding: 1rem;
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-search input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sidebar-search svg {
    position: absolute;
    right: 1.75rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.sidebar.collapsed .sidebar-search svg {
    right: 50%;
    transform: translateX(50%);
}

/* Pesquisa geral – dropdown de resultados */
.global-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow);
    z-index: 100;
}
.global-search-results.is-open {
    display: block;
}
.global-search-results .search-section {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.global-search-results .search-section:last-child {
    border-bottom: none;
}
.global-search-results .search-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.35rem 1rem;
}
.global-search-results .search-result-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s;
}
.global-search-results .search-result-item:hover {
    background: var(--bg-color);
}
.global-search-results .search-result-item .result-title {
    font-weight: 500;
}
.global-search-results .search-result-item .result-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.global-search-results .search-empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.menu-category {
    margin-bottom: 1.5rem;
}

.menu-category-title {
    padding: 0.5rem 1rem 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    transition: opacity 0.3s ease;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 0.5rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    position: relative;
    font-size: 0.9rem;
    font-weight: 500;
}

.menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.menu-item:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.menu-item:hover svg {
    color: var(--primary-color);
}

.menu-item.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    color: var(--primary-color);
    font-weight: 600;
}

.menu-item.active svg {
    color: var(--primary-color);
}

.menu-item.active .menu-indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-color);
    border-radius: 0 3px 3px 0;
}

.menu-label {
    flex: 1;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: var(--bg-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
    transition: opacity 0.3s ease;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--danger-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-logout svg {
    flex-shrink: 0;
}

/* Main Content Wrapper */
.main-content-wrapper {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content-wrapper {
    margin-left: 80px;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.mobile-menu-toggle:hover {
    background: var(--bg-color);
}

.header-title {
    flex: 1;
}

.header-title h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-header-icon:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

/* 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;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar:not(.collapsed) {
        transform: translateX(0);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
    }
    
    .main-content-wrapper {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar.collapsed ~ .main-content-wrapper {
        margin-left: 0;
    }
    
    .container {
        padding: 1rem 15px;
    }
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #ffffff;
    position: relative;
    overflow: hidden;
}

.login-background-logo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
    animation: logoBreath 8s ease-in-out infinite;
}

@keyframes logoBreath {
    0%, 100% {
        opacity: 0.08;
        transform: scale(1);
    }
    50% {
        opacity: 0.12;
        transform: scale(1.02);
    }
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-container--two {
    max-width: 900px;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: flex-start;
}

.login-container--two .login-box {
    flex: 1 1 320px;
    max-width: 400px;
}

.ponto-card {
    min-width: 280px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.login-box .logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.login-box .logo-container img {
    max-width: 200px;
    max-height: 100px;
    object-fit: contain;
}

.login-box h1 {
    text-align: center;
    color: #2563eb;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.login-box h2 {
    text-align: center;
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 1rem;
    font-weight: normal;
}

.ponto-card h3,
.ponto-box h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.ponto-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.ponto-buttons .btn {
    flex: 1;
}

.ponto-msg {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

.ponto-msg.alert-error {
    background: #fef2f2;
    color: #b91c1c;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

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

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

.btn-secondary:hover {
    background-color: #475569;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* Icon Buttons */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
}

.btn-icon:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.btn-icon.btn-edit {
    color: #2563eb;
}

.btn-icon.btn-edit:hover {
    background: #dbeafe;
}

.btn-icon.btn-delete {
    color: #ef4444;
}

.btn-icon.btn-delete:hover {
    background: #fee2e2;
}

.btn-icon.btn-history {
    color: #8b5cf6;
}

.btn-icon.btn-history:hover {
    background: #ede9fe;
}

.btn-icon.btn-view {
    color: #10b981;
}

.btn-icon.btn-view:hover {
    background: #d1fae5;
}

.btn-icon svg {
    display: block;
}

/* Action buttons container */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 2rem 0;
}

.page-header h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

/* Filters */
.filters {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.search-box {
    margin-bottom: 1rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.filter-btn:hover {
    background-color: var(--bg-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Table */
.table-container {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

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

.data-table thead {
    background-color: var(--bg-color);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background-color: var(--bg-color);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Tabela Manutenções – mais compacta para evitar scroll horizontal */
#manutencoesTable {
    table-layout: fixed;
    font-size: 0.85rem;
}
#manutencoesTable th,
#manutencoesTable td {
    padding: 0.5rem 0.6rem;
}
#manutencoesTable td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem !important;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

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

.badge-proposta-enviada {
    background-color: #e0e7ff;
    color: #3730a3;
}

.badge-resolvido {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-criacao {
    background-color: #f3f4f6;
    color: #374151;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.5rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-icon:hover {
    background-color: var(--bg-color);
}

.btn-edit {
    color: var(--primary-color);
}

.btn-delete {
    color: var(--danger-color);
}

.btn-history {
    color: var(--warning-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    margin: auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

/* Modal de chamadas - adapta ao tamanho do ecrã */
#modalChamada .modal-content {
    max-width: 1000px;
    width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

#modalChamada .modal-header {
    flex-shrink: 0;
}

#modalChamada form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem;
}

#modalChamada .form-group {
    margin-bottom: 1rem;
    flex-shrink: 0;
}

#modalChamada textarea {
    min-height: 60px;
    resize: vertical;
}

#modalChamada .modal-footer {
    flex-shrink: 0;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

/* Modal Peças – referência e nome na mesma linha, menos scroll */
#modalPeca .modal-content {
    max-height: 90vh;
    overflow-y: auto;
}
#modalPeca .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}
#modalPeca .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}
#modalPeca .form-group {
    margin-bottom: 1rem;
}
#modalPeca textarea {
    rows: 2;
    min-height: 56px;
    resize: vertical;
}

/* Modal de histórico - maior */
#modalHistorico .modal-content {
    max-width: 1400px;
    width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

#modalHistorico .modal-header {
    flex-shrink: 0;
}

#modalHistorico .modal-body {
    padding: 1.5rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#modalHistorico .table-container {
    margin-top: 1rem;
}

/* Modal de histórico de tickets - mesmo estilo */
#modalHistoricoTicket .modal-content {
    max-width: 1400px;
    width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#modalHistoricoTicket .modal-header {
    flex-shrink: 0;
}

#modalHistoricoTicket .modal-body {
    padding: 1.5rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#modalHistoricoTicket .table-container {
    margin-top: 1rem;
}

#modalHistoricoTicket .modal-footer {
    flex-shrink: 0;
}

#modalHistorico .data-table {
    font-size: 0.95rem;
}

#modalHistorico .data-table th,
#modalHistorico .data-table td {
    padding: 1rem 1.25rem;
    white-space: nowrap;
}

#modalHistorico .data-table td {
    white-space: normal;
    max-width: 300px;
    word-wrap: break-word;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.close {
    color: var(--text-secondary);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-primary);
}

.modal form {
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header .container {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .header-logo-section {
        flex: 1;
        min-width: 0;
    }
    
    .header-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .filter-buttons {
        justify-content: center;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-secondary {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

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

/* Tooltip para motivo do atendimento */
.tooltip-motivo {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    max-width: 400px;
}

.tooltip-content {
    background-color: #1e293b;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.5;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tooltip-content::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #1e293b;
}

.row-tooltip {
    cursor: help;
}

/* Tooltip para agenda */
.tooltip-agenda {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    max-width: 300px;
}

.tooltip-agenda-content {
    background-color: #1e293b;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.5;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tooltip-agenda-content::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #1e293b;
}

/* Footer */
.main-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 0;
    margin-top: 2rem;
    box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.05);
}

.main-footer .container {
    text-align: center;
}

.main-footer p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

