@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0');

:root {
    /* Light Mode Variables */
    --bg-color: #f4f7f6;
    --text-color: #333333;
    --sidebar-bg: #ffffff;
    --sidebar-text: #555555;
    --sidebar-active: #f0f4ff;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --primary-color: #10b981;
    --primary-hover: #059669;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --input-bg: #ffffff;
    --input-border: #cccccc;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    /* Dark Mode Variables */
    --bg-color: #121212;
    --text-color: #f0f0f0;
    --sidebar-bg: #1e1e1e;
    --sidebar-text: #b0b0b0;
    --sidebar-active: #2a2a2a;
    --header-bg: #1e1e1e;
    --card-bg: #1e1e1e;
    --border-color: #333333;
    --primary-color: #34d399;
    --primary-hover: #10b981;
    --input-bg: #2c2c2c;
    --input-border: #444444;
    --shadow: 0 4px 6px rgba(0,0,0,0.3);
}

/* Fix Native Date/Time Picker Icons for Dark Mode */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

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

body {
    font-family: 'Raleway', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Layout Utilities */
.app-container {
    display: flex;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    transition: width var(--transition-speed);
    z-index: 1000;
}

.sidebar.collapsed {
    width: 80px;
    scrollbar-width: none; /* Firefox */
}

.sidebar.collapsed::-webkit-scrollbar {
    display: none; /* Chrome, Edge, Safari */
    width: 0;
}

/* Deixar a barra fina na versão normal */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.sidebar-logo {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.sidebar-logo-link {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.sidebar-logo-link img {
    max-height: 40px;
    width: auto;
}

/* Base Logo Visibility (Light Mode) */
.logo-dark { display: none; }
.logo-icon-only { display: none; }
.logo-light { display: block; }

/* Dark Mode Logo Visibility */
body[data-theme="dark"] .logo-light { display: none; }
body[data-theme="dark"] .logo-dark { display: block; }

/* Collapsed Sidebar Logo Visibility (Overrides Theme) */
.sidebar.collapsed .logo-text { display: none; }
.sidebar.collapsed .logo-full { display: none !important; }
.sidebar.collapsed .logo-light { display: none !important; }
.sidebar.collapsed .logo-dark { display: none !important; }
.sidebar.collapsed .logo-icon-only { display: block !important; }

.sidebar-logo h2 {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--primary-color);
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    padding: 0.5rem 1rem;
}

.sidebar-menu .menu-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--sidebar-text);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    opacity: 0.7;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--sidebar-text);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: var(--sidebar-active);
    color: var(--primary-color);
}

/* Regras quando a barra está suprimida */
.sidebar.collapsed .sidebar-menu .menu-header {
    display: none; /* Esconde os títulos das categorias */
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center; /* Centraliza o ícone */
    padding-left: 0;
    padding-right: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 250px; /* Default sidebar width */
    transition: margin-left var(--transition-speed);
    min-height: 100vh;
    width: calc(100% - 250px);
}

/* Topbar */
.topbar {
    height: 70px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* Content Area */
.page-content {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: none;
    font-family: 'Raleway', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

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

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

/* Inputs */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: 'Raleway', sans-serif;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Custom Switch */
.switch-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--sidebar-text);
}

.switch-input {
    appearance: none;
    -webkit-appearance: none;
    width: 32px;
    height: 18px;
    background: var(--border-color);
    border-radius: 20px;
    position: relative;
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}

.switch-input::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch-input:checked {
    background: var(--primary-color);
}

.switch-input:checked::after {
    transform: translateX(14px);
}

/* User Dropdown */
.user-dropdown-container {
    position: relative;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: var(--sidebar-active);
}

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

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-info .user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info .user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text);
}

.user-dropdown-menu {
    position: absolute;
    top: 110%;
    right: 0;
    width: 200px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

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

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1.25rem;
    color: var(--text-color);
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.user-dropdown-menu a:hover {
    background-color: var(--sidebar-active);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

.text-danger {
    color: var(--danger-color) !important;
}
