/**
 * Dashboard Layout Engine Styles
 * Phase 2: Dynamic grid system with liquid glass widgets
 */

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 20px;
    padding: 20px 0;
}

/* Widget Container */
.dashboard-widget {
    background: rgba(10, 14, 39, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 20px;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.dashboard-widget:hover {
    background: rgba(10, 14, 39, 0.6);
    border-color: rgba(0, 212, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
                0 0 20px rgba(0, 212, 255, 0.2);
}

/* Widget Header */
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.widget-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.widget-actions {
    display: flex;
    gap: 8px;
}

.widget-action-btn {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.widget-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #00d4ff;
}

/* Widget Content */
.widget-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Loading State */
.widget-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Error State */
.widget-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.widget-error svg {
    color: rgba(255, 100, 100, 0.6);
}

/* Placeholder State */
.widget-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

.widget-placeholder svg {
    color: rgba(255, 255, 255, 0.3);
}

.widget-placeholder p {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

.placeholder-note {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.metric-card-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.metric-card-mini:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.metric-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.metric-info {
    flex: 1;
    min-width: 0;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-trend {
    font-size: 11px;
    color: #00ff00;
    margin-top: 4px;
}

/* Search History List */
.search-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.history-item svg {
    color: #00d4ff;
    flex-shrink: 0;
}

.history-query {
    flex: 1;
    color: #ffffff;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    flex-shrink: 0;
}

/* Mobile Responsive */
/* Desktop Large */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(8, 1fr);
    }

    .dashboard-widget {
        grid-column: span 8 !important;
    }
}

/* Tablet (iPad) */
@media (max-width: 1024px) and (min-width: 769px) {
    .dashboard-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 18px;
    }

    .dashboard-widget {
        grid-column: span 6 !important;
        padding: 24px;
    }

    .widget-title {
        font-size: 18px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .metric-value {
        font-size: 24px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
        padding: 16px 0;
    }

    .dashboard-widget {
        grid-column: span 4 !important;
        padding: 20px;
    }

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

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .metric-card-mini {
        padding: 12px;
    }

    .metric-icon {
        font-size: 24px;
    }

    .metric-value {
        font-size: 20px;
    }

    /* Touch-friendly interactive elements */
    .widget-action-btn,
    .history-item {
        min-height: 44px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .dashboard-widget {
        grid-column: span 1 !important;
        padding: 16px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-card-mini {
        flex-direction: row;
    }
}

/* Accessibility */
.widget-action-btn:focus-visible {
    outline: 2px solid #00d4ff;
    outline-offset: 2px;
}

.history-item:focus-visible {
    outline: 2px solid #00d4ff;
    outline-offset: -2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .dashboard-widget,
    .widget-action-btn,
    .metric-card-mini,
    .history-item {
        transition: none;
    }

    .dashboard-widget:hover {
        transform: none;
    }
}

/* Text Utilities */
.text-muted {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}
