/**
 * Capitao Trader Calendar Styles
 */

/* Importação da fonte Unicons */
@import url('https://unicons.iconscout.com/release/v4.0.0/css/line.css');

.capitao-trader-calendar {
    max-width: 1000px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Calendar Header */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.calendar-nav {
    display: flex;
    align-items: center;
}

.calendar-nav button {
    background: #f7f7f7;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
}

.calendar-nav button:hover {
    background: #e7e7e7;
}

.calendar-nav h2 {
    margin: 0 15px;
    font-size: 20px;
}

.calendar-views {
    display: flex;
}

.calendar-views button {
    background: #f7f7f7;
    border: 1px solid #ccc;
    padding: 5px 15px;
    cursor: pointer;
    font-size: 14px;
}

.calendar-views button:first-child {
    border-radius: 3px 0 0 3px;
}

.calendar-views button:last-child {
    border-radius: 0 3px 3px 0;
}

.calendar-views button.active {
    background: #007cba;
    color: #fff;
    border-color: #006799;
}

/* Month View */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f7f7f7;
    border-bottom: 1px solid #e0e0e0;
}

.weekday {
    text-align: center;
    padding: 10px;
    font-weight: bold;
}

/* Estilizar fim de semana */
.weekday:first-child,
.weekday:last-child {
    color: #999;
    background-color: #f5f5f5;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, minmax(100px, 1fr));
    grid-gap: 1px;
    background: #e0e0e0;
    border: 1px solid #e0e0e0;
    min-height: 600px;
    
    /* Garantir altura mínima para 6 linhas */
}

.day {
    background: #fff;
    min-height: 100px;
    height: 100%;
    padding: 5px;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
}

/* Estilizar dias de fim de semana */
.day:nth-child(7n),
.day:nth-child(7n+1) {
    background-color: #f9f9f9;
}

.day:nth-child(7n) .date,
.day:nth-child(7n+1) .date {
    color: #999;
}

.day.empty {
    background: #f7f7f7;
    min-height: 100px;
    height: 100%;
}

/* Ajustar cores dos valores para fim de semana */
.day:nth-child(7n) .day-value,
.day:nth-child(7n+1) .day-value {
    opacity: 0.7;
}

/* Ajustar hover para fim de semana */
.day:nth-child(7n):hover,
.day:nth-child(7n+1):hover {
    background-color: #f0f0f0;
}

/* Ajustar eventos para fim de semana */
.day:nth-child(7n) .events,
.day:nth-child(7n+1) .events {
    opacity: 0.7;
}

/* Ajustar cursor para fim de semana */
.day:nth-child(7n),
.day:nth-child(7n+1) {
    cursor: not-allowed;
}

/* Ajustar cursor para valores em fim de semana */
.day:nth-child(7n) .day-value,
.day:nth-child(7n+1) .day-value {
    cursor: not-allowed;
}

.day .date {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    z-index: 1;
}

.day .day-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: .800rem;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    z-index: 1;
}

.day .day-value.positive {
    color: #155724;
    cursor: pointer;
}

.day .day-value.negative {
    color: #721c24;
    cursor: pointer;
}

.day .day-value.zero {
    color: #856404;
    cursor: pointer;
}

.day:hover .date {
    background: #f7f7f7;
}

.day.has-events .date {
    background: #007cba;
    color: #fff;
    cursor: pointer;
}

.day.today .date {
    background: #d54e21;
    color: #fff;
}

.day.selected .date {
    background: #007cba;
    color: #fff;
    cursor: pointer;
}

.day .events {
    margin-top: 30px;
    flex-grow: 1;
    overflow-y: auto;
    max-height: calc(100% - 30px);
}

.day .event {
    margin-bottom: 5px;
    padding: 3px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* Week View */
.week-view .days {
    grid-template-rows: 1fr;
}

.week-view .day {
    min-height: 150px;
}

/* Day View */
.day-view {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 20px;
}

.day-view .selected-date {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Trader List */
.trader-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trader-item {
    border-bottom: 1px solid #f0f0f0;
    padding: 10px 0;
}

.trader-item:last-child {
    border-bottom: none;
}

.trader-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: #333;
}

.trader-title {
    font-weight: bold;
}

.trader-ativo {
    color: #666;
}

.trader-result {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: bold;
    text-align: center;
    margin-left: 10px;
}

.trader-green {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.trader-loss {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.trader-zero {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Responsive */
@media (max-width: 768px) {
    .calendar-header {
    }

    .days {
        overflow-x: auto;
        /* Permite rolagem horizontal em telas pequenas */
    }

    .day {
        padding: 16px 8px;
        /* Mais espaço interno para melhor visualização */
        box-sizing: border-box;
        min-width: 120px;
        /* Garante largura mínima para rolar horizontalmente */
    }


    .calendar-nav,
    .calendar-views {
        margin-bottom: 10px;
        width: 100%;
    }

    .calendar-views {
        justify-content: space-between;
    }

    .calendar-views button {
        flex: 1;
        text-align: center;
    }

    .weekday {
        padding: 20px;
        font-size: 12px;
    }

    .days {
        min-height: 400px;
        border: 1px solid #e0e0e0;
    }

    .day {
        min-height: 60px;
        border: 1px solid #e0e0e0;
    }

    .day.empty {
        min-height: 60px;
    }

    .day .events {
        margin-top: 20px;
    }

    .day .date {
        width: 20px;
        height: 20px;
        font-size: .75rem;
    }

    .day .day-value {
        font-size: .75rem;
    }

    .trader-item {
        padding: 10px;
    }

    .trader-item-header {
        padding: 10px;
    }

    .trader-item-thumbnail {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }

    .trader-title {
        font-size: 14px;
    }

    .trader-ativo {
        font-size: 12px;
    }

    .trader-result {
        font-size: 10px;
        padding: 2px 6px;
    }

    .day.has-events .date {
        font-size: 10px;
        width: 18px;
        height: 18px;
    }

    .day.has-events .events {
        font-size: 12px;
        margin-top: 15px;
    }

    .day.has-events .event {
        font-size: 10px;
        padding: 2px;
    }
}

/* Estilos para a lista de operações do dia */
.day-posts-list {
    margin-top: 20px;
}

.trader-item {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    overflow: hidden;
}

.trader-item-header {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
}

.trader-item-header:hover {
    background-color: #f8f9fa;
}

.trader-item-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 25px;
    overflow: hidden;
    margin-right: 15px;
    flex-shrink: 0;
}

.trader-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-thumbnail {
    width: 100%;
    height: 100%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #6c757d;
    text-transform: uppercase;
}

.trader-item-info {
    flex-grow: 1;
}

.trader-title {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
}

.trader-ativo {
    font-size: 14px;
    color: #6c757d;
    margin-right: 10px;
}

.trader-result {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.trader-result.green {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.trader-result.loss {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.trader-result.zero {
    background-color: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.trader-item-toggle {
    margin-left: 15px;
}

.toggle-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    position: relative;
    transition: transform 0.3s ease;
}

.toggle-icon:before,
.toggle-icon:after {
    content: '';
    position: absolute;
    background-color: #6c757d;
    transition: transform 0.3s ease;
}

.toggle-icon:before {
    width: 2px;
    height: 12px;
    top: 4px;
    left: 9px;
}

.toggle-icon:after {
    width: 12px;
    height: 2px;
    top: 9px;
    left: 4px;
}

.trader-item-header.active .toggle-icon {
    transform: rotate(45deg);
}

.trader-item-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.trader-item-details.active {
    max-height: 500px;
    /* Ajuste este valor conforme necessário */
}

.trader-details-content {
    padding: 15px;
}

.detail-row {
    display: flex;
    margin-bottom: 10px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    width: 100px;
    font-weight: 600;
    color: #495057;
}

.detail-value {
    flex-grow: 1;
}

.detail-value.positive {
    color: #28a745;
}

.detail-value.negative {
    color: #dc3545;
}

.no-traders {
    text-align: center;
    color: #6c757d;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Loading e Error States */
.loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.error {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* Thumbnail Preview Section */
.thumbnail-preview-section {
    margin-bottom: 20px;
    text-align: center;
}

.thumbnail-preview {
    width: 200px;
    height: 200px;
    margin: 0 auto 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.thumbnail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.view-full-image {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.view-full-image:hover {
    background: #006799;
}

/* Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 1280px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1001;
}

.close-modal:hover {
    color: #333;
}

.modal-title {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

.modal-image-container {
    width: 100%;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .thumbnail-preview {
        width: 150px;
        height: 150px;
    }

    .modal-content {
        width: 95%;
        padding: 15px;
    }

    .modal-title {
        font-size: 16px;
    }

    .modal-image-container {
        max-height: 70vh;
    }
}

/* Tooltip aprimorado */
#calendar-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 0;
    border-radius: 8px;
    font-size: .875rem;
    z-index: 1000;
    pointer-events: none;
    display: none;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 1;
    transform: none;
    min-width: 200px;
}

#calendar-tooltip.visible {
    display: block;
}

.tooltip-header {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px 8px 0 0;
}

.tooltip-date {
    font-weight: 500;
    text-transform: capitalize;
}

.tooltip-content {
    padding: 12px 15px;
}

.tooltip-value {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.tooltip-action {
    font-size: 12px;
    opacity: 0.8;
    text-align: center;
    font-style: italic;
}

#calendar-tooltip:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    margin-left: -8px;
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #3498db transparent transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

/* Estilos específicos para diferentes tipos de valores */
#calendar-tooltip.positive {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

#calendar-tooltip.negative {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
}

#calendar-tooltip.zero {
    background: linear-gradient(135deg, #f39c12, #f1c40f);
}

#calendar-tooltip.positive:after {
    border-color: #2ecc71 transparent transparent;
}

#calendar-tooltip.negative:after {
    border-color: #e74c3c transparent transparent;
}

#calendar-tooltip.zero:after {
    border-color: #f1c40f transparent transparent;
}

/* Melhorias no hover do valor */
.day-value {
    cursor: pointer;
    position: relative;
    padding: 4px 8px;
    border-radius: 4px;
}



@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
    }
}