:root {
    --primary: #FF8C00;
    --primary-light: #FFA500;
    --primary-dark: #E67E22;
    --secondary: #1E1E2F;
    --dark: #12121D;
    --light: #F8F9FA;
    --accent: #FF5E00;
    --gray-400: #888;
    --gray-600: #444;
    --gray-700: #2a2a3e;
    --success: #10B981;
    --error: #EF4444;
    --info: #3B82F6;
    --warning: #F59E0B;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--dark);
    color: var(--light);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content>* {
    animation: fadeIn 0.5s ease forwards;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Auth Styles */
.auth-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e1e2f, #12121d);
}

.auth-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.auth-card h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 30px;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-400);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 15px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus,
select:focus,
textarea:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.15);
}

select option {
    background: var(--secondary);
    color: white;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 94, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 94, 0, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-add-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--glass-border);
    color: var(--gray-400);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-color: var(--primary);
    border-style: solid;
}

.auth-links {
    margin-top: 2rem;
    font-size: 14px;
    color: var(--gray-400);
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--dark);
    position: relative;
}

.mobile-header {
    display: none;
    padding: 1rem 1.5rem;
    background: var(--secondary);
    border-bottom: 1px solid var(--glass-border);
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon-sm {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.header-brand h2 {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1400;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--secondary);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
    overflow: visible; /* Alterado de overflow-x: hidden para permitir o botão flutuante */
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
    margin-bottom: 0;
}

.close-menu {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.collapse-btn {
    background: var(--primary);
    border: 2px solid var(--dark); /* Borda escura para dar destaque */
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    right: -16px; /* Metade do tamanho para ficar centralizado na linha */
    top: 35px; /* Altura próxima ao logo */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

.collapse-btn:hover {
    transform: scale(1.1);
    background: var(--primary-light);
}

/* Estilo da Seta de Recolher */
.collapse-btn i, 
.collapse-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Quando o menu está encolhido, gira a seta */
.sidebar.collapsed .collapse-btn i,
.sidebar.collapsed .collapse-btn svg {
    transform: rotate(180deg) !important;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.sidebar h2 {
    color: white;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    margin-bottom: 2rem;
}

.avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: white;
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.3);
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for ellipsis */
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 12px;
    color: #4ade80; /* Brighter green */
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.user-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
}

.sidebar-nav {
    list-style: none;
    flex: 1;
}

.sidebar-nav li {
    margin-bottom: 8px;
}

.sidebar-nav a {
    color: var(--gray-400);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-nav a i {
    width: 20px;
    height: 20px;
}

.sidebar-nav a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(255, 140, 0, 0.15) 0%, transparent 100%);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.logout-link {
    color: #ff6b6b; /* More vibrant red-ish */
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    padding: 14px;
    border-radius: 12px;
    transition: all 0.3s;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.logout-link i {
    width: 18px;
    height: 18px;
}

.logout-link:hover {
    color: white;
    background: rgba(239, 68, 68, 0.2);
}

/* Collapsed Sidebar Styles */
.sidebar.collapsed {
    width: 88px !important;
    padding: 2rem 1rem !important;
}

.sidebar.collapsed .logo-container h2,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
}

/* Hide text in collapsed mode */
.sidebar.collapsed h2,
.sidebar.collapsed .user-info,
.sidebar.collapsed .logout-link span,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-status {
    display: none !important;
}

/* Or just hide everything but icons in nav */
.sidebar.collapsed .sidebar-nav a {
    font-size: 0 !important;
    gap: 0 !important;
    justify-content: center !important;
    padding: 12px 0 !important;
}

.sidebar.collapsed .logout-link {
    font-size: 0 !important;
    gap: 0 !important;
    justify-content: center !important;
    padding: 14px 0 !important;
}

.sidebar.collapsed .sidebar-nav a {
    font-size: 0;
    gap: 0;
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    gap: 20px;
}

.sidebar.collapsed .logo-container {
    padding: 0;
    justify-content: center;
}

.sidebar.collapsed .user-profile {
    padding: 0.75rem;
    justify-content: center;
}

.sidebar.collapsed .sidebar-footer {
    padding-top: 1.5rem;
}

.sidebar.collapsed .logout-link i,
.sidebar.collapsed .sidebar-nav a i {
    margin: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 3rem;
    background: radial-gradient(circle at top right, #1a1a2e, #12121d);
    overflow-y: auto;
}

.main-content h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 2rem;
    color: white;
}

/* Stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-md);
}

.stat-card h3 {
    font-size: 13px;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
}

/* Tables */
.table-container {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 1rem;
    overflow-x: auto;
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--gray-400);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--glass-border);
}

table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

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

table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-open {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.badge-done {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-cancel {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge-entregue {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

/* Modals */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--secondary);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    padding: 2.5rem;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlide {
    from { opacity: 0; transform: scale(0.95) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Action Links */
.action-link {
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s;
}

.action-link:hover {
    filter: brightness(1.2);
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 1500;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar.sidebar-open {
        left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        padding: 1.5rem;
        width: 100%;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .main-content h1 {
        font-size: 24px;
    }

    .close-menu {
        display: block;
    }
}

@media (max-width: 600px) {
    .modal-content {
        padding: 1.5rem;
        border-radius: 0;
        height: 100%;
        max-height: 100%;
        width: 100%;
    }

    .btn-primary {
        padding: 12px;
    }

    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: 0;
        height: 100vh;
        max-width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}