/* Widget Styles for Sidetrack Assistant
 * Contains styles for Date Widget, Graph Widget, and other widget components
 */

/* Common Widget Styles */
.message.assistant .date-widget,
.message.assistant .graph-widget,
.message.assistant .image-widget {
    margin: 12px 0;
    max-width: 100%;
    overflow-y: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* ========================================
   DATE WIDGET
   ======================================== */

.date-widget {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin: 16px 0;
    overflow: visible !important;
    overflow-y: visible !important;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

.date-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.date-widget-date {
    flex: 1;
}

.date-widget-day {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.date-widget-date-number {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.date-widget-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-nav-btn {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    color: #333;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.date-nav-btn:hover {
    background-color: #f0f0f0;
    border-color: #ddd;
}

.date-widget-content {
    padding: 0;
    overflow-x: auto !important;
    overflow-y: visible !important;
    max-width: 100%;
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
}

.date-section {
    border-bottom: 1px solid #f0f0f0;
    padding: 16px 20px;
}

.date-section:last-child {
    border-bottom: none;
}

.date-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.date-section-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.date-section-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.date-section-count {
    background-color: #f0f0f0;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

.date-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.date-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 3px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 0;
    overflow: visible !important;
    overflow-y: visible !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

.date-item-type-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.date-item:hover {
    background-color: #f0f0f0;
    border-color: #ddd;
}

.date-item-time {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    min-width: 70px;
    padding-top: 2px;
}

.date-item-content {
    flex: 1;
    min-width: 0;
    overflow: visible !important;
    overflow-y: visible !important;
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
}

.date-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: hidden;
}

.date-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #666;
    flex-wrap: wrap;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: hidden;
}

.date-item-location {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.date-item-duration {
    color: #999;
}

.date-item-action {
    display: flex;
    align-items: center;
}

.date-item-menu-btn {
    background-color: transparent;
    border: none;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-item-menu-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.journal-entry-preview {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin-top: 6px;
    font-style: italic;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: hidden;
}

.date-widget-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* Responsive Date Widget */
@media (max-width: 768px) {
    .date-widget-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .date-widget-nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .date-nav-btn {
        flex: 1;
    }
    
    .date-item {
        flex-direction: column;
        gap: 8px;
    }
    
    .date-item-time {
        min-width: auto;
    }
    
    .date-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .date-widget-footer {
        flex-direction: column;
    }
    
    .date-widget-footer .btn {
        width: 100%;
    }
}

/* ========================================
   GRAPH WIDGET
   ======================================== */

.graph-widget {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin: 16px 0;
    overflow: visible !important;
    overflow-y: visible !important;
    height: auto !important;
    max-height: none !important;
}

.graph-widget-header {
    padding: 16px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.graph-widget-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.graph-widget-content {
    padding: 20px;
    background-color: #ffffff;
}

.graph-widget-content canvas {
    max-width: 100%;
    height: auto;
}

.graph-widget-footer {
    padding: 12px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    font-weight: 500;
}

/* Responsive Graph Widget */
@media (max-width: 768px) {
    .graph-widget-header {
        padding: 12px 16px;
    }
    
    .graph-widget-title {
        font-size: 14px;
    }
    
    .graph-widget-content {
        padding: 16px;
    }
    
    .graph-widget-footer {
        padding: 10px 16px;
    }
    
    .graph-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ========================================
   IMAGE WIDGET
   ======================================== */

.image-widget {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin: 16px 0;
    overflow: visible !important;
    overflow-y: visible !important;
    height: auto !important;
    max-height: none !important;
    transition: all 0.3s ease;
}

.image-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

.image-widget-controls {
    display: flex;
    gap: 4px;
}

.image-size-btn {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    color: #333;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.image-size-btn:hover:not(:disabled) {
    background-color: #f0f0f0;
    border-color: #ddd;
}

.image-size-btn:disabled {
    cursor: not-allowed;
}

.image-menu-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
}

.image-menu-btn:hover {
    background-color: #e0e0e0;
    color: #333;
}

.image-menu-dropdown {
    position: absolute;
    right: 8px;
    top: 100%;
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease-out;
    margin-top: 4px;
}

.image-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.image-menu-item {
    padding: 10px 16px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-menu-item:first-child {
    border-radius: 6px 6px 0 0;
}

.image-menu-item:last-child {
    border-radius: 0 0 6px 6px;
}

.image-menu-item:hover {
    background-color: #f8f9fa;
}

.image-widget-content {
    padding: 0;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.widget-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    object-fit: contain;
    transition: all 0.3s ease;
}

.image-widget-footer {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.image-metadata {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metadata-item {
    display: flex;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
}

.metadata-label {
    color: #666;
    font-weight: 600;
    min-width: 85px;
    flex-shrink: 0;
}

.metadata-value {
    color: #333;
    flex: 1;
}

/* Size variants - Widget controls size, not image */
.image-widget[data-size="small"] {
    width: 250px;
    max-width: 100%;
}

.image-widget[data-size="medium"] {
    width: 400px;
    max-width: 100%;
}

.image-widget[data-size="large"] {
    width: 100%;
    max-width: 100%;
}

/* Responsive Image Widget */
@media (max-width: 768px) {
    .image-widget-header {
        padding: 8px 10px;
    }
    
    .image-size-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .image-widget-footer {
        padding: 10px 12px;
    }
    
    .metadata-item {
        flex-direction: column;
        gap: 2px;
    }
    
    .metadata-label {
        min-width: auto;
    }
    
    /* On mobile, adjust sizes to fit better */
    .image-widget[data-size="small"] {
        width: 180px;
        max-width: 100%;
    }
    
    .image-widget[data-size="medium"] {
        width: 100%;
        max-width: 100%;
    }
    
    .image-widget[data-size="large"] {
        width: 100%;
        max-width: 100%;
    }
}

