/* ===== RESET E ESTILOS GERAIS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f7f7fb;
    min-height: 100vh;
    color: #3a3a3a;
    line-height: 1.6;
}

body.dark-mode {
    background: #23263a !important;
    color: #f3f3fa !important;
}

/* ===== LAYOUT PRINCIPAL (INDEX.PHP) ===== */
.main-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #f7f7fb;
}

.menu {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    width: 260px;
    background: #fff;
    color: #7c3aed;
    padding-top: 24px;
    flex-shrink: 0;
    box-shadow: 2px 0 16px rgba(60, 60, 120, 0.06);
    border-right: 1px solid #ececec;
}

.menu.dark-mode {
    background: #23263a !important;
    color: #a78bfa !important;
    box-shadow: 2px 0 16px rgba(30, 30, 60, 0.13);
    border-right: 1px solid #23263a;
}

.menu .logo {
    text-align: center;
    padding: 40px 0 24px 0;
}

.menu .logo img {
    max-width: 80%;
    height: auto;
}

.menu a {
    text-decoration: none;
    color: #7c3aed;
    padding: 16px 28px;
    display: block;
    transition: background 0.2s, color 0.2s, border 0.2s;
    border-left: 4px solid transparent;
    font-weight: 500;
    font-size: 1.08rem;
    border-radius: 0 20px 20px 0;
    margin: 0 0 4px 0;
}

.menu a:hover {
    background: #f3f0ff;
    color: #6d28d9;
    border-left: 4px solid #a78bfa;
}

.menu a.active,
.menu .menu-item.active {
    background: #ede9fe;
    color: #6d28d9;
    border-left: 4px solid #7c3aed;
    font-weight: 600;
}

.menu.dark-mode a {
    color: #a78bfa !important;
}
.menu.dark-mode a.active,
.menu.dark-mode .menu-item.active {
    background: #312e81 !important;
    color: #fbbf24 !important;
    border-left: 4px solid #a78bfa !important;
}
.menu.dark-mode a:hover {
    background: #23263a !important;
    color: #fbbf24 !important;
}

.content {
    flex: 1;
    overflow: hidden;
    background: #f7f7fb;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #f7f7fb;
}

/* ===== PÁGINA DE LOGIN ===== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.login-container h1 {
    margin: 0 0 2rem;
    font-size: 2rem;
    text-align: center;
    color: #2d3748;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    font-size: 0.95rem;
    color: #4a5568;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.form-group input {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.form-group input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 1);
}

.login-button {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.error-message {
    color: red;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* ===== CONTAINERS E LAYOUT GERAL ===== */
.container {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(60, 60, 120, 0.07);
    margin-top: 20px;
    margin-bottom: 20px;
}

.page-title {
    text-align: center;
    color: #7c3aed;
    margin-bottom: 40px;
    font-size: 2.2rem;
    font-weight: 700;
}

.page-title.dark-mode, .section-title.dark-mode {
    color: #a78bfa !important;
}

.section-title {
    color: #6d28d9;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 600;
}

/* ===== FORMULÁRIOS ===== */
.form-container {
    background: #fff;
    padding: 36px;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(60, 60, 120, 0.07);
    margin-bottom: 30px;
    border: 1px solid #ececec;
}

.form-container h2 {
    color: #7c3aed;
    margin-bottom: 30px;
    font-size: 1.3rem;
    font-weight: 600;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #6d28d9;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafaff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #a78bfa;
    outline: none;
    box-shadow: 0 0 0 2px #ede9fe;
    background: #fff;
}

.form-group textarea {
    height: 120px;
    resize: vertical;
}

.form-group input[type="number"] {
    width: 100px;
}

/* ===== BOTÕES ===== */
.btn {
    padding: 13px 26px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.07);
}

.btn-primary {
    background: #7c3aed;
    color: #fff;
}

.btn-primary:hover {
    background: #6d28d9;
}

.btn-success {
    background: #22c55e;
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-warning {
    background: #f59e42;
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn.dark-mode, .btn-primary.dark-mode {
    background: #a78bfa !important;
    color: #181824 !important;
}
.btn.dark-mode:hover, .btn-primary.dark-mode:hover {
    background: #fbbf24 !important;
    color: #23263a !important;
}

/* ===== TABELAS ===== */
.table-container {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(60, 60, 120, 0.07);
    overflow: hidden;
    margin-top: 30px;
    border: 1px solid #ececec;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 16px 18px;
    text-align: left;
    border-bottom: 1px solid #f3f0ff;
}

table th {
    background: #ede9fe;
    color: #7c3aed;
    font-weight: 600;
    font-size: 0.97rem;
}

table tr:hover {
    background: #f3f0ff;
    transition: all 0.2s;
}

.actions {
    text-align: center;
}

.actions a {
    margin: 0 5px;
    padding: 5px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.95rem;
}

.actions .edit {
    background: #a78bfa;
    color: #fff;
}

.actions .delete {
    background: #ef4444;
    color: #fff;
}

.actions a:hover {
    opacity: 0.85;
}

.container.dark-mode, .form-container.dark-mode, .table-container.dark-mode, .chart-container.dark-mode {
    background: #23263a !important;
    color: #f3f3fa !important;
    box-shadow: 0 8px 32px rgba(30, 30, 60, 0.13);
    border: 1px solid #23263a !important;
}

/* Tabelas */
table.dark-mode th, table.dark-mode td {
    background: #23263a !important;
    color: #f3f3fa !important;
    border-bottom: 1px solid #312e81 !important;
}
table.dark-mode th {
    background: #312e81 !important;
    color: #a78bfa !important;
}

/* ===== DASHBOARD ===== */
.dashboard-container {
    padding: 20px;
}

.charts-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.chart-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(60, 60, 120, 0.07);
    padding: 22px;
    height: 400px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #ececec;
    transition: box-shadow 0.2s;
}

.chart-container:hover {
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.10);
}

.chart-container canvas {
    max-width: 100% !important;
    max-height: calc(100% - 50px) !important;
    width: 100% !important;
    height: calc(100% - 50px) !important;
    flex: 1;
}

.chart-container .chartjs-tooltip {
    position: absolute !important;
    z-index: 1000 !important;
}

.chart-title {
    text-align: center;
    font-size: 1.15rem;
    margin-bottom: 18px;
    color: #7c3aed;
    font-weight: 700;
    position: relative;
    z-index: 10;
}

.chart-title.dark-mode {
    color: #a78bfa !important;
}

/* ===== MENSAGENS ===== */
.message {
    padding: 15px;
    border-radius: 7px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background-color: #e0f7e9;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.message.error {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.message.warning {
    background-color: #fef9c3;
    color: #a16207;
    border: 1px solid #fde68a;
}

.message.dark-mode.success {
    background-color: #134e4a !important;
    color: #bbf7d0 !important;
    border: 1px solid #22d3ee !important;
}
.message.dark-mode.error {
    background-color: #7f1d1d !important;
    color: #fecaca !important;
    border: 1px solid #f87171 !important;
}
.message.dark-mode.warning {
    background-color: #78350f !important;
    color: #fde68a !important;
    border: 1px solid #fbbf24 !important;
}

/* ===== BOTÃO DE TREINAMENTO ===== */
.start-training-btn {
    text-align: center;
    margin: 20px 0;
}

.start-training-btn form {
    display: inline-block;
}

.start-training-btn button {
    background: #7c3aed;
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.start-training-btn button:hover {
    background: #6d28d9;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }
    .menu {
        width: 100vw !important;
        min-width: 0 !important;
        height: 56px;
        max-height: 56px;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        border-right: none;
        border-bottom: 1px solid #ececec;
        box-shadow: 0 2px 8px rgba(60, 60, 120, 0.06);
        padding: 0;
        overflow-x: auto;
        overflow-y: hidden;
        background: #fff;
    }
    .menu .logo {
        display: none;
    }
    .menu a {
        border-radius: 0;
        border-left: none;
        border-bottom: 4px solid transparent;
        margin: 0;
        padding: 0 14px;
        font-size: 1.1rem;
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 56px;
    }
    .menu a.active,
    .menu .menu-item.active {
        border-bottom: 4px solid #7c3aed;
        border-left: none;
        background: #ede9fe;
    }
    #toggleMenuBtn {
        display: none !important;
    }
    .content {
        margin-left: 0 !important;
        margin-top: 56px !important;
        width: 100vw;
        min-width: 0;
    }
}

@media (max-width: 600px) {
    .container, .form-container {
        padding: 10px;
        border-radius: 8px;
    }
    .charts-wrapper {
        gap: 10px;
    }
    .chart-container {
        height: 260px;
        padding: 8px;
        border-radius: 8px;
    }
    .chart-title {
        font-size: 1rem;
        margin-bottom: 10px;
    }
}

/* ===== UTILITÁRIOS ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}

/* ===== ESTADOS ===== */
.status-ativo {
    color: #27ae60;
    font-weight: 600;
}

.status-inativo {
    color: #e74c3c;
    font-weight: 600;
}

.status-sim {
    color: #27ae60;
    font-weight: 600;
}

.status-nao {
    color: #e74c3c;
    font-weight: 600;
} 

/* ===== MENU RECOLHÍVEL ===== */
.menu.collapsed {
    width: 60px !important;
    min-width: 60px;
    transition: width 0.2s;
    overflow-x: hidden;
    box-shadow: 2px 0 16px rgba(60, 60, 120, 0.06);
}
.menu.collapsed .logo {
    display: none;
}
.menu.collapsed a {
    padding: 16px 10px;
    font-size: 1.3rem;
    text-align: center;
    border-radius: 12px;
    white-space: nowrap;
    overflow: hidden;
}
.menu.collapsed a:not(:last-child) {
    margin-bottom: 2px;
}
.menu.collapsed a::after {
    content: '';
}
.menu.collapsed a {
    color: #7c3aed;
}
.menu.collapsed a span, .menu.collapsed a .menu-text {
    display: none;
}
.menu.collapsed #toggleMenuBtn {
    justify-content: center;
    padding-left: 0;
}
@media (max-width: 900px) {
    .menu.collapsed {
        width: 0 !important;
        min-width: 0;
        padding: 0;
        border: none;
    }
    .menu.collapsed #toggleMenuBtn {
        display: block;
        margin: 0 auto;
    }
}
.content {
    transition: margin-left 0.2s;
}
.menu.collapsed ~ .content {
    margin-left: 60px;
}
@media (max-width: 900px) {
    .menu.collapsed ~ .content {
        margin-left: 0;
    }
} 

.menu a i {
    margin-right: 10px;
    font-size: 1.35em;
    vertical-align: middle;
    transition: margin 0.2s;
}
.menu.collapsed a i {
    margin-right: 0;
} 

.theme-btn {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.07);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c3aed;
    font-size: 2rem;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    z-index: 1100;
    border: none;
    outline: none;
    cursor: pointer;
    margin-left: 0;
    margin-right: 10px;
}
.theme-btn:hover {
    background: #ede9fe;
    color: #6d28d9;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.13);
}
.menu {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.menu .theme-btn, .menu .logout-btn {
    margin-top: auto;
    margin-bottom: 24px;
}
.menu .logout-btn {
    margin-right: 18px;
    margin-left: 0;
}
.menu .theme-btn {
    margin-left: auto;
    margin-right: 0;
}
.menu .theme-btn + .logout-btn {
    margin-left: 0;
}
@media (max-width: 900px) {
    .theme-btn, .logout-btn {
        position: static !important;
        margin-bottom: 0;
        margin-top: 0;
        margin-left: 0;
        margin-right: 10px;
    }
    .menu .logout-btn {
        margin-right: 18px;
    }
}
.menu.dark-mode .theme-btn {
    background: #23263a !important;
    color: #a78bfa !important;
}
.menu.dark-mode .theme-btn:hover {
    background: #312e81 !important;
    color: #fbbf24 !important;
}

.logout-btn {
    position: absolute;
    right: 18px;
    bottom: 24px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.07);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c3aed;
    font-size: 2rem;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    z-index: 1100;
    border: none;
    outline: none;
    cursor: pointer;
    text-decoration: none;
}
.logout-btn:hover {
    background: #ede9fe !important;
    color: #6d28d9 !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.13);
}
.menu.dark-mode .logout-btn {
    background: #23263a !important;
    color: #a78bfa !important;
}
.menu.dark-mode .logout-btn:hover {
    background: #312e81 !important;
    color: #fbbf24 !important;
}
@media (max-width: 900px) {
    .logout-btn {
        position: static;
        margin-left: auto;
        margin-right: 18px;
        margin-bottom: 0;
        top: unset;
        right: unset;
        bottom: unset;
        z-index: 1100;
    }
} 

.menu-actions {
    margin-top: auto;
    display: flex;
    flex-direction: row;
    width: 100%;
    justify-content: flex-end;
    gap: 10px;
    align-items: flex-end;
    padding-right: 12px;
    margin-bottom: 18px;
}
.theme-btn, .logout-btn {
    min-width: 44px;
    min-height: 44px;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    margin-left: 0;
    margin-right: 0;
}
.logout-btn:hover {
    background: #ede9fe !important;
    color: #6d28d9 !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.13);
}
@media (max-width: 900px) {
    .menu-actions {
        margin-bottom: 0;
        padding-right: 8px;
        padding-top: 0;
    }
} 

.content.dark-mode {
    background: #181824 !important;
} 

.menu-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    left: auto;
    background: none;
    border: none;
    color: #7c3aed;
    font-size: 2.2rem;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    transition: color 0.2s, background 0.2s, left 0.2s, right 0.2s, transform 0.2s;
    box-shadow: none;
}
.menu-toggle:focus {
    outline: none;
}
.menu-toggle:hover {
    color: #a78bfa;
    background: none;
}
.menu.collapsed .menu-toggle {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    top: 16px;
    background: none;
}
@media (max-width: 900px) {
    .menu-toggle {
        display: none !important;
    }
} 

/* ===== AJUSTE MENU MOBILE GARANTIDO ===== */
@media (max-width: 900px) {
    .menu {
        display: none !important;
    }
    .menu.mobile-visible {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        min-height: 100vh;
        z-index: 2000;
        box-shadow: 2px 0 16px rgba(60, 60, 120, 0.16);
        background: #fff;
        transition: left 0.3s;
        overflow-y: auto;
    }
    .menu.dark-mode.mobile-visible {
        background: #23263a !important;
    }
    .menu-toggle {
        display: block !important;
        position: fixed !important;
        top: 12px !important;
        left: 12px !important;
        z-index: 2100 !important;
        background: #fff;
        border-radius: 50%;
        box-shadow: 0 2px 8px rgba(124, 58, 237, 0.07);
        width: 44px;
        height: 44px;
        color: #7c3aed;
        font-size: 2rem;
        border: none;
        outline: none;
        cursor: pointer;
    }
    .menu-toggle.dark-mode {
        background: #23263a !important;
        color: #a78bfa !important;
    }
    .content {
        margin-left: 0 !important;
        margin-top: 56px !important;
        width: 100vw;
        min-width: 0;
    }
} 

/* ===== BOTÃO HAMBURGUER MOBILE ===== */
.menu-hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2100;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.07);
    width: 44px;
    height: 44px;
    color: #7c3aed;
    font-size: 2rem;
    border: none;
    outline: none;
    cursor: pointer;
}
.menu-hamburger.dark-mode {
    background: #23263a !important;
    color: #a78bfa !important;
}
@media (max-width: 900px) {
    .menu-hamburger {
        display: block !important;
    }
} 

/* ===== BARRA DE AÇÕES MOBILE ===== */
.mobile-actions-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 56px;
    background: transparent;
    z-index: 2200;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
}
.mobile-only {
    display: none !important;
}
@media (max-width: 900px) {
    .mobile-actions-bar {
        display: flex !important;
    }
    .mobile-only {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    .menu .menu-actions, .menu .theme-btn, .menu .logout-btn {
        display: none !important;
    }
} 

/* ===== AJUSTE BOTÃO HAMBURGUER NA BARRA MOBILE ===== */
@media (max-width: 900px) {
    .mobile-actions-bar .menu-hamburger {
        position: static !important;
        z-index: auto !important;
        margin-right: 8px;
    }
} 