/* PALETA DE CORES - Instituto Bom Samaritano */
:root {
    --primary-azul: #0095B3;      /* Azul principal */
    --primary-cyan: #00D4E8;      /* Cyan - detalhes */
    --primary-laranja: #F39C12;   /* Laranja - destaques */
    --dark-blue: #004D6D;         /* Azul escuro */
    --light-gray: #F5F5F5;        /* Cinza claro */
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0095B3 0%, #004D6D 100%);
    min-height: 100vh;
    display: flex;
}

.fixed-top-container {
    position: fixed;
    top: 0;
    left: 224px;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #E8E8E8;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
    transition: left 0.3s ease;
}

.fixed-top-container.expanded {
    left: 64px;
}

.top-left-icons {
    display: flex;
    align-items: center;
}

.top-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4em;
    color: #004D6D;
    margin-right: 15px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.top-icon-btn:hover {
    color: #0095B3;
    transform: scale(1.1);
}

.search-container {
    display: flex;
    align-items: center;
    background: #F5F5F5;
    border-radius: 25px;
    padding: 5px 15px;
    transition: all 0.3s ease;
    margin-left: 50px;
}

.search-container:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 149, 179, 0.5);
}

.search-input {
    border: none;
    background: none;
    outline: none;
    font-size: 1em;
    padding: 5px;
    width: 200px;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    color: #7f8c8d;
    padding: 0 5px;
}

/* SIDEBAR */
.sidebar {
    width: 224px;
    background: linear-gradient(180deg, #004D6D 0%, #0095B3 100%);
    color: white;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    transition: width 0.3s ease, transform 0.3s ease;
}

.sidebar.collapsed {
    width: 64px;
    overflow: visible;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(0, 212, 232, 0.3);
    text-align: center;
    position: relative;
}

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

.sidebar-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
    color: #00D4E8;
}

.toggle-menu-collapse {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.5em;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
}

.toggle-menu-collapse.rotated {
    transform: translateY(-50%) rotate(180deg);
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    margin-bottom: 5px;
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    color: #ECF0F1;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
}

.menu-link:hover {
    background: rgba(0, 212, 232, 0.2);
    padding-left: 30px;
}

.sidebar.collapsed .menu-link:hover {
    padding-left: 20px;
}

.sidebar.collapsed .menu-text {
    display: none;
}

.menu-link.active {
    background: linear-gradient(90deg, #F39C12, #E67E22);
    border-left: 4px solid #fff;
}

.menu-icon {
    font-size: 1.2em;
    margin-right: 12px;
    transition: margin-right 0.3s ease;
    min-width: 24px;
    text-align: center;
}

.sidebar.collapsed .menu-icon {
    margin-right: 0;
}

.submenu {
    display: none;
    background: rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
}

.submenu.show {
    display: block;
}

.sidebar.collapsed .menu-item:hover > .submenu {
    position: absolute;
    left: 64px;
    top: 0;
    width: 200px;
    background: #004D6D;
    z-index: 1001;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    display: block !important;
    animation: slideDownHover 0.2s ease;
    border-radius: 0 8px 8px 0;
}

.submenu-link {
    display: block;
    padding: 10px 20px 10px 55px;
    color: #BDC3C7;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.sidebar.collapsed .menu-item:hover .submenu-link {
    padding-left: 20px;
}

.submenu-link:hover {
    background: rgba(0, 212, 232, 0.2);
    color: #fff;
    padding-left: 65px;
}

.sidebar.collapsed .menu-item:hover .submenu-link:hover {
    padding-left: 30px;
}

.menu-arrow {
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

.menu-arrow.rotated {
    transform: rotate(180deg);
}

.sidebar.collapsed .menu-arrow {
    display: none;
}

/* CONTEÚDO PRINCIPAL */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 70px 10px 10px 10px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.main-content.expanded {
    margin-left: 64px;
}

.dashboard-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: linear-gradient(135deg, #0095B3, #00D4E8);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 149, 179, 0.3);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

.kpi-value {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 5px;
}

.kpi-label {
    font-size: 1.1em;
    opacity: 0.9;
}

.kpi-change {
    margin-top: 8px;
    font-size: 0.9em;
}

.positive { color: #2ecc71; }
.negative { color: #e74c3c; }

.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.chart-title {
    font-size: 1.3em;
    color: #004D6D;
    margin-bottom: 15px;
    font-weight: 600;
}

.bottom-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.table-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ECF0F1;
    white-space: nowrap;
}

.data-table th {
    background: #F8F9FA;
    font-weight: 600;
    color: #004D6D;
}

.status-active { color: #27ae60; font-weight: bold; }
.status-pending { color: #F39C12; font-weight: bold; }
.status-inactive { color: #e74c3c; font-weight: bold; }

.action-btn {
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    margin: 0 2px;
}

.edit-btn {
    background-color: #0095B3;
    color: white;
}

.edit-btn:hover {
    background-color: #004D6D;
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background-color: #c0392b;
}

.progress-bar {
    background: #ECF0F1;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin: 5px 0;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.refresh-btn {
    background: linear-gradient(135deg, #0095B3, #00D4E8);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    transition: transform 0.3s ease;
}

.refresh-btn:hover {
    transform: scale(1.05);
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: #004D6D;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 200px; }
}

@keyframes slideDownHover {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* MODAL E MESSAGE BOX */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-title {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #004D6D;
}

.modal-message {
    margin-bottom: 25px;
    color: #555;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.modal-ok-btn {
    background: #0095B3;
    color: white;
}

.modal-ok-btn:hover {
    background: #004D6D;
}

.modal-cancel-btn {
    background: #ccc;
    color: #333;
}

.modal-cancel-btn:hover {
    background: #bbb;
}

/* FORMULÁRIO */
.form-section {
    padding: 20px;
    background: white;
    border-radius: 15px;
}

.form-section h2 {
    font-size: 1.8em;
    color: #004D6D;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #004D6D;
    margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0095B3;
    box-shadow: 0 0 0 2px rgba(0, 149, 179, 0.2);
}

.form-actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.form-submit-btn, .form-reset-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s;
}

.form-submit-btn {
    background: linear-gradient(135deg, #0095B3, #00D4E8);
    color: white;
}

.form-submit-btn:hover {
    transform: scale(1.05);
}

.form-reset-btn {
    background: #ECF0F1;
    color: #004D6D;
}

.form-reset-btn:hover {
    background: #ddd;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: block;
    }
    .main-content {
        margin-left: 0;
        padding: 90px 10px 20px 10px;
    }
    .fixed-top-container {
        left: 0;
        padding: 0 10px;
    }
    .charts-section,
    .bottom-section {
        grid-template-columns: 1fr;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .fixed-top-container h1 {
        font-size: 1.4em;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-container {
        padding: 20px 10px;
        margin: 0;
    }
    .table-container {
        padding: 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        min-width: 600px;
        font-size: 0.9em;
    }
    .data-table th,
    .data-table td {
        padding: 8px;
        font-size: 0.85em;
    }
    .action-btn {
        padding: 4px 8px;
        font-size: 0.8em;
        margin: 1px;
    }
    .search-container {
        margin-left: 10px;
    }
    .search-input {
        width: 120px;
    }
}