/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0E4BF1;
    --accent-color: #6C5DD3;
    --gradient-1: linear-gradient(135deg, #AB85FF 0%, #6C5DD3 100%);
    --gradient-2: linear-gradient(135deg, #02AAB0 0%, #00CDAC 100%);
    --gradient-3: linear-gradient(135deg, #FF6B6B 0%, #EE5D5D 100%);
    --sidebar-width: 250px;
    --header-height: 60px;
    --font-main: 'Poppins', sans-serif;
}

/* Dark Theme (Default) */
:root,
[data-theme="dark"] {
    --bg-body: #121212;
    --bg-sidebar: #000000;
    --bg-card: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --search-bg: #2b2b2b;
    --table-border: #333;
    --calendar-filter: invert(1);
}

/* Light Theme */
[data-theme="light"] {
    --bg-body: #e8e8e8;
    --bg-sidebar: #f0f0f0;
    --bg-card: #f0f0f0;
    --text-primary: #111827; /* Darker charcoal */
    --text-secondary: #4b5563; /* Darker gray */
    --border-color: rgba(0, 0, 0, 0.1);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --search-bg: #e0e5f2;
    --table-border: #cbd5e1;
    --calendar-filter: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    min-height: 100vh;
    background: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar,
.calendar-sidebar {
    position: fixed;
    height: 100%;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    /* Higher z-index for overlay */
    padding: 20px 0;
    /* Remove horizontal padding for buttons to touch edges */
    display: flex;
    flex-direction: column;
    gap: 20px;
    left: 0;
}

.sidebar.close {
    width: 78px;
}

/* Sidebar Logo Details */
.sidebar .logo-details {
    /* height: 60px; Removed fixed height to let flex/gap handle it, or keep it auto */
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center content like agenda */
    padding: 0;
}

/* Hamburger Menu specific for Index Sidebar */
.sidebar .logo-details .hamburger-menu {
    min-width: 78px;
    /* Match sidebar collapsed width center */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: #fff;
    z-index: 101;
}

.sidebar .logo-details .logo_name {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 1;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
}


.sidebar.close .logo-details .logo_name {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.sidebar .user-profile-sidebar {
    padding: 20px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
}

.sidebar.close .user-profile-sidebar {
    justify-content: center;
    padding: 20px 0;
}

.sidebar.close .user-profile-sidebar .user-name {
    display: none;
}

.sidebar .user-avatar {
    color: #fff;
    font-size: 20px;
    margin-right: 10px;
}

.sidebar .user-name {
    color: #fff;
    font-weight: 500;
}

.sidebar .nav-links {
    height: 100%;
    padding: 10px 0 150px 0;
    overflow: auto;
}

.sidebar .nav-links::-webkit-scrollbar {
    display: none;
}

.sidebar .nav-links li {
    position: relative;
    list-style: none;
    transition: all 0.4s ease;
}

.sidebar .nav-links li:hover {
    background: transparent;
}

.sidebar .nav-links li.active {
    background: transparent;
}

.sidebar .nav-links li .iocn-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar .nav-links li a {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 2px 25px;
    /* 2px vertical, increased horizontal */
    margin: 4px 2px;
    /* Reduced horizontal margin to 2px as requested */
    border-radius: 12px;
    transition: all 0.2s ease;
}

.sidebar .nav-links li.active a {
    color: #fff;
}

.sidebar .nav-links li a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar .nav-links li a i {
    height: 32px;
    /* Reduced icon height for compact pill */
    min-width: 45px;
    /* Reduced icon width */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 15px;
    /* Match agenda spacing */
    min-width: 24px;
    /* Match agenda icon width */
    text-align: center;
}

.sidebar .nav-links li.active a i,
.sidebar .nav-links li:hover a i {
    color: #fff;
}

.sidebar .nav-links li a .link_name {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-secondary);
    transition: all 0.4s ease;
}

.sidebar .nav-links li.active a .link_name,
.sidebar .nav-links li:hover a .link_name {
    color: #fff;
}

.sidebar.close .nav-links li a .link_name {
    opacity: 0;
    pointer-events: none;
}

/* Responsive Sidebar & Layout (Global) */
@media (max-width: 1024px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        width: var(--sidebar-width);
        z-index: 1100;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0;
    }

    .home-section {
        left: 0 !important;
        width: 100% !important;
    }

    /* Overlay Backdrop Blur Effect */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        z-index: 1050;
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .home-section .top-nav {
        padding: 0 20px;
    }

    .home-section .top-nav .search-box {
        display: none;
    }
}

@media (max-width: 768px) {
    .home-section .top-nav .profile-details .admin_name {
        display: none;
    }

    .logo-mobile {
        display: block !important;
        font-size: 1.2rem;
        font-weight: 700;
        letter-spacing: 1px;
    }
}

/* Hide Mobile Logo on Desktop */
.logo-mobile {
    display: none;
}

/* Sidebar Logo Details (Replaces inline styles in producao.html) */
.sidebar .logo-details-container {
    display: flex;
    align-items: center;
    gap: 0;
    padding-left: 0;
}

.sidebar .hamburger-container {
    min-width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 24px;
}

.sidebar .logo-name-container {
    margin-left: 10px;
    transition: opacity 0.3s;
    white-space: nowrap;
}

/* Lista Button Styles */
.create-action {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    /* Default margin */
}

.create-action button.btn-create {
    width: 100%;
    padding: 12px 20px;
    border-radius: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center text like agenda */
    position: relative;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center text like agenda */
    position: relative;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    gap: 0;
    /* Remove gap as icon is absolute */
}

.create-action button.btn-create:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.create-action button.btn-create i {
    font-size: 24px;
    color: #2d62ed;
    /* Vibrant Blue */
    position: absolute;
    /* Absolute psitioning like agenda */
    left: 20px;
}

/* Dropdown Styles */
.lista-dropdown {
    display: none;
    position: absolute;
    top: 110%;
    /* Below button */
    left: 20px;
    width: calc(100% - 40px);
    /* Match button width */
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
    flex-direction: column;
}

.lista-dropdown.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.dropdown-item {
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
    display: block;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sidebar Footer (Theme Toggle & Logout) */
.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.mode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.mode-toggle:hover {
    background: var(--hover-bg);
}

.mode-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-secondary);
}

.mode-info i {
    font-size: 20px;
}

.mode-info span {
    font-size: 14px;
    font-weight: 400;
}

/* Toggle Switch */
.switch {
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    position: relative;
    transition: background 0.3s;
}

.switch::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

[data-theme="dark"] .switch {
    background: var(--primary-color);
}

[data-theme="dark"] .switch::before {
    transform: translateX(20px);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    border-radius: 12px;
    margin-top: 5px;
}

.logout-link:hover {
    background: var(--hover-bg);
    color: #FF6B6B;
}

.logout-link i {
    font-size: 20px;
}

/* Selective Card Linking Styles */
.modal-section-title {
    font-size: 13px;
    text-transform: uppercase;
    color: #a0a0a0;
    margin: 20px 0 10px 30px;
    letter-spacing: 1px;
    font-weight: 600;
}

.modal-cards-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 30px 10px 30px;
}

.card-selection-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.card-selection-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.card-selection-item.selected {
    background: rgba(0, 205, 172, 0.1);
    border-color: #00CDAC;
    color: #00CDAC;
}

.card-selection-item i {
    font-size: 18px;
    opacity: 0.5;
}

.card-selection-item.selected i {
    opacity: 1;
}

.card-selection-item span {
    font-size: 14px;
    font-weight: 500;
}

.modal-loading-text {
    opacity: 0.5;
    font-size: 13px;
    padding-left: 5px;
}

/* Glassmorphism for cards */
.box-list-full {
    background: var(--bg-card) !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Form refinement */
.form-control,
.form-select {
    background-color: var(--search-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(14, 75, 241, 0.25) !important;
}

/* Fix for date input icon color */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: var(--calendar-filter, invert(1));
    cursor: pointer;
}

/* Fix for Select Dropdown Options */
select option {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    padding: 10px !important;
}

/* Specialized Badges */
.badge-ambiente {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-ambiente.homologacao {
    background: rgba(0, 205, 172, 0.15);
    color: #00CDAC;
    border: 1px solid rgba(0, 205, 172, 0.3);
}

.badge-ambiente.producao {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

/* Premium Button Animation */
.btn-premium {
    background: var(--gradient-1);
    border: none;
    color: white;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(108, 93, 211, 0.3);
    color: #fff;
}