/* Importar fonte Poppins do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Paleta de cores */
    --cyan-primary: #16A8A8;
    --cyan-light: #2FA8A8;
    --cyan-dark: #0A8282;
    --green-primary: #37A877;
    --green-secondary: #16A869;
    --green-dark: #0B8F56;
    --black-primary: #0D0D0D;
    --black-secondary: #151717;
    --gray-light: #D7EFEF;
    --gray-medium: #E5EFEF;
    --gray-dark: #B6D6D6;
    --background-black: #000000;
    --text-white: #ffffff;
    --text-gray: rgba(255, 255, 255, 0.7);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--black-primary);
    min-height: 100vh;
    color: var(--text-white);
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(60% 50% at 50% 0%, rgba(22, 168, 168, 0.15), transparent 70%);
}

.login-box {
    background: var(--black-secondary);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
}

.login-box h1 {
    text-align: center;
    color: var(--text-white);
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    text-align: center;
    color: var(--text-gray);
    margin-bottom: 30px;
    font-weight: 300;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-white);
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--black-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-white);
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--cyan-primary);
    box-shadow: 0 0 0 3px rgba(22, 168, 168, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--cyan-primary);
    border: 1px solid var(--cyan-primary);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--cyan-primary);
    color: var(--black-primary);
    transform: translateY(-1px);
}

.error-message {
    display: none;
    margin-top: 15px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

/* Dashboard */
.dashboard {
    display: flex;
    min-height: 100vh;
    background: var(--black-primary);
}

.sidebar {
    width: 260px;
    background: var(--black-secondary);
    color: var(--text-white);
    padding: 24px;
    border-right: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.logo svg {
    flex-shrink: 0;
}

.logo h2 {
    font-weight: 600;
    color: var(--cyan-primary);
    margin: 0;
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.logo-img-login {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(22, 168, 168, 0.3));
}

.menu {
    list-style: none;
}

.menu li {
    margin-bottom: 10px;
}

.menu a {
    display: block;
    padding: 12px 16px;
    color: var(--text-gray);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    font-weight: 400;
}

.menu a:hover {
    color: var(--text-white);
    border-color: var(--border-light);
    background: rgba(22, 168, 168, 0.05);
}

.menu a.active {
    color: var(--cyan-primary);
    border-color: var(--cyan-primary);
    background: rgba(22, 168, 168, 0.1);
}

.content {
    flex: 1;
    padding: 30px;
    background: radial-gradient(60% 50% at 50% 0%, rgba(22, 168, 168, 0.08), transparent 70%);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--black-secondary);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

header h1 {
    color: var(--text-white);
    font-weight: 600;
}

.user-info {
    color: var(--text-gray);
    font-weight: 400;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.card {
    background: var(--black-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
}

.card-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    color: var(--text-white);
    font-weight: 600;
    font-size: 18px;
    margin: 0;
}

.card-header button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--green-primary);
    background: transparent;
    color: var(--green-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.card-header button:hover {
    background: var(--green-primary);
    color: var(--black-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(55, 168, 119, 0.3);
}

.saldo {
    font-size: 36px;
    font-weight: 700;
    color: var(--green-primary);
    margin-top: 10px;
}

.form-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-inline input, .form-inline select {
    padding: 10px 14px;
    background: var(--black-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-white);
    transition: all 0.3s ease;
}

.form-inline input:focus, .form-inline select:focus {
    outline: none;
    border-color: var(--cyan-primary);
}

.form-inline input {
    flex: 1;
    min-width: 150px;
}

.form-inline select {
    cursor: pointer;
}

.form-inline select option {
    background: var(--black-secondary);
    color: var(--text-white);
}

.form-inline button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

table th {
    background: rgba(22, 168, 168, 0.05);
    font-weight: 600;
    color: var(--text-white);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    color: var(--text-gray);
    font-weight: 400;
}

table tr:hover {
    background: rgba(22, 168, 168, 0.03);
}

.valor-positivo {
    color: var(--green-primary);
    font-weight: 600;
}

.valor-negativo {
    color: #ef4444;
    font-weight: 600;
}

.status-ativa {
    color: var(--green-primary);
    font-weight: 600;
}

.status-fechada {
    color: var(--text-gray);
    font-weight: 400;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: transparent;
}

.btn-success {
    border-color: var(--green-primary);
    color: var(--green-primary);
}

.btn-success:hover {
    background: var(--green-primary);
    color: var(--black-primary);
}

.btn-danger {
    border-color: #ef4444;
    color: #ef4444;
}

.btn-danger:hover {
    background: #ef4444;
    color: var(--text-white);
}

.btn-warning {
    border-color: var(--cyan-primary);
    color: var(--cyan-primary);
}

.btn-warning:hover {
    background: var(--cyan-primary);
    color: var(--black-primary);
}

/* Responsividade */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    
    .content {
        padding: 20px;
    }
    
    .form-inline {
        flex-direction: column;
    }
    
    .form-inline input, .form-inline select, .form-inline button {
        width: 100%;
    }
}

/* Binance Price Check */
.binance-price-check {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.binance-price-check input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    background: var(--black-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-white);
}

.binance-price-check input:focus {
    outline: none;
    border-color: var(--cyan-primary);
}

.binance-price-check button {
    padding: 10px 20px;
    white-space: nowrap;
}

.price-result {
    width: 100%;
    margin-top: 15px;
    min-height: 40px;
}

.price-info {
    background: rgba(22, 168, 168, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 15px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.price-label {
    color: var(--text-gray);
    font-size: 14px;
}

.price-value {
    color: var(--text-white);
    font-size: 18px;
    font-weight: 600;
}

.price-highlight {
    color: var(--green-primary);
}

.price-info button {
    margin-top: 10px;
}

/* Sistema de Trava */
.trava-system {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.trava-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trava-input-group label {
    color: var(--text-white);
    font-weight: 500;
    font-size: 14px;
}

.trava-input-group input,
.trava-input-group select {
    padding: 12px 16px;
    background: var(--black-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 16px;
    color: var(--text-white);
    transition: all 0.3s ease;
}

.trava-input-group input:focus,
.trava-input-group select:focus {
    outline: none;
    border-color: var(--cyan-primary);
}

.trava-actions {
    display: flex;
    gap: 10px;
}

.cotacao-result {
    min-height: 40px;
}

.cotacao-info {
    background: rgba(22, 168, 168, 0.05);
    border: 1px solid var(--cyan-primary);
    border-radius: 8px;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

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

.cotacao-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.cotacao-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.cotacao-label {
    color: var(--text-gray);
    font-size: 14px;
}

.cotacao-value {
    color: var(--green-primary);
    font-size: 32px;
    font-weight: 700;
}

.cotacao-total-value {
    color: var(--cyan-primary);
    font-size: 24px;
    font-weight: 700;
}

.cotacao-time {
    margin-bottom: 20px;
    color: var(--text-gray);
    font-size: 12px;
}

.cotacao-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cotacao-buttons button {
    flex: 1;
    min-width: 150px;
}

/* Resumo do Dia */
.resumo-dia {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.resumo-item {
    background: rgba(22, 168, 168, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
}

.resumo-item:hover {
    border-color: var(--cyan-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 168, 168, 0.2);
}

.resumo-item.highlight {
    background: linear-gradient(135deg, rgba(22, 168, 168, 0.1), rgba(55, 168, 119, 0.1));
    border: 2px solid var(--cyan-primary);
    padding: 24px;
}

.resumo-item.highlight:hover {
    box-shadow: 0 6px 20px rgba(22, 168, 168, 0.3);
}

.resumo-label {
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resumo-value {
    color: var(--text-white);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.resumo-value.lucro {
    color: var(--green-primary);
}

.resumo-subtitle {
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 400;
    margin-top: -5px;
}

.trava-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(22, 168, 168, 0.05);
    border: 1px solid var(--cyan-primary);
    border-radius: 8px;
    margin-top: 10px;
}

.trava-total span:first-child {
    color: var(--text-gray);
    font-size: 14px;
}

.trava-total span:last-child {
    color: var(--cyan-primary);
    font-size: 24px;
    font-weight: 700;
}

/* Modais */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.modal-content {
    background-color: var(--black-secondary);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: var(--text-white);
    margin-bottom: 20px;
}

.close {
    color: var(--text-gray);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: var(--text-white);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-white);
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--black-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-white);
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--cyan-primary);
}

.form-group select option {
    background: var(--black-secondary);
    color: var(--text-white);
}

/* Botões adicionais */
.btn-success {
    background: transparent;
    color: var(--green-primary);
    border: 1px solid var(--green-primary);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-success:hover {
    background: var(--green-primary);
    color: var(--black-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(55, 168, 119, 0.3);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 168, 168, 0.3);
}

/* Ocultar elementos baseado em permissão */
[data-role]:not([data-role*="master"]) {
    display: none;
}

/* Importação de Excel */
#importStatus {
    background: rgba(22, 168, 168, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 15px;
}

#importStatus p {
    margin: 5px 0;
    font-size: 14px;
}

/* Documentos */
.documento-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: rgba(22, 168, 168, 0.05);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.documento-item:hover {
    border-color: var(--cyan-primary);
    transform: translateY(-2px);
}

.documento-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.documento-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--black-primary);
    border-radius: 8px;
    font-size: 24px;
}

.documento-details {
    flex: 1;
}

.documento-tipo {
    color: var(--text-white);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
}

.documento-nome {
    color: var(--text-gray);
    font-size: 12px;
    margin-bottom: 3px;
}

.documento-data {
    color: var(--text-gray);
    font-size: 11px;
}

.documento-actions {
    display: flex;
    gap: 10px;
}

.documento-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    margin-top: 10px;
}


/* Seletor Tipo de Pessoa */
.tipo-pessoa-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(22, 168, 168, 0.05);
    border-radius: 8px;
}

.tipo-pessoa-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    background: var(--black-primary);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tipo-pessoa-btn:hover {
    border-color: var(--cyan-primary);
    color: var(--text-white);
}

.tipo-pessoa-btn.active {
    border-color: var(--cyan-primary);
    background: rgba(22, 168, 168, 0.1);
    color: var(--cyan-primary);
}

.form-cliente {
    padding: 20px 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .tipo-pessoa-selector {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}


/* Modal Detalhes Cliente */
.cliente-header {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.cliente-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    opacity: 0.9;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

/* Resumo item com texto longo */
.resumo-item .resumo-value {
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Modal grande responsivo */
.modal-content.modal-lg {
    max-width: 1000px;
}

/* Responsividade do modal de detalhes */
@media (max-width: 768px) {
    .modal-content {
        margin: 2% auto;
        padding: 20px;
        width: 95%;
        max-height: 95vh;
    }
    
    .resumo-dia {
        grid-template-columns: 1fr !important;
    }
    
    .cliente-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        text-align: center;
    }
    
    .documento-item {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .documento-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .card-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .card-header h3 {
        margin-bottom: 0;
    }
    
    table {
        font-size: 12px;
    }
    
    table th, table td {
        padding: 10px 8px;
    }
}

/* Texto com overflow */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-wrap {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Dados do cliente no modal */
#detClienteEmail,
#detClienteEndereco,
#detClienteTelefone,
#detClienteDoc {
    word-break: break-all;
    font-size: 14px !important;
    line-height: 1.4;
}

/* Ajuste para valores grandes */
.resumo-value {
    font-size: clamp(16px, 4vw, 32px);
}

.resumo-item {
    min-width: 0; /* Permite que o flex item encolha */
}

/* Tabela responsiva */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    #detTransacoesTable th:nth-child(2),
    #detTransacoesTable td:nth-child(2) {
        display: none;
    }
}
