/**
 * User Activity Dashboard Styles
 * Color Palette:
 * - Background: #F8F9FA
 * - Bleu de France: #3083DC
 * - Jet: #2D2D2A
 * - Teal: #2DD4BF
 * - Steel: #6B7280
 * - Poppy: #DF2935
 */

:root {
    --baby-powder: #F8F9FA;
    --bleu-de-france: #3083DC;
    --jet: #2D2D2A;
    --selective-yellow: #2DD4BF;
    --steel: #6B7280;
    --poppy: #DF2935;
}

/* Dashboard Container */
.uad-dashboard {
    background-color: var(--baby-powder);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(45, 45, 42, 0.1);
    padding: 24px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header */
.uad-header {
    margin-bottom: 32px;
    border-bottom: 2px solid var(--bleu-de-france);
    padding-bottom: 16px;
}

.uad-title {
    color: var(--jet);
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 16px 0;
}

/* Summary Cards */
.uad-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.uad-summary-item {
    background: linear-gradient(135deg, var(--bleu-de-france), var(--bleu-de-france));
    background-color: var(--bleu-de-france);
    color: var(--baby-powder);
    padding: 16px 20px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(48, 131, 220, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.uad-summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(48, 131, 220, 0.3);
}

.uad-summary-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.uad-summary-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
}

.uad-balance {
    color: var(--selective-yellow);
}

/* Date Picker */
.uad-date-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 16px 0;
    padding: 16px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(45, 45, 42, 0.1);
}

.uad-date-picker label {
    font-size: 14px;
    font-weight: 600;
    color: var(--jet);
    margin: 0;
}

.uad-date-input {
    padding: 8px 12px;
    border: 2px solid var(--bleu-de-france);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: var(--jet);
    background: var(--baby-powder);
    transition: all 0.2s ease;
    min-width: 150px;
}

.uad-date-input:hover {
    border-color: var(--selective-yellow);
}

.uad-date-input:focus {
    outline: none;
    border-color: var(--selective-yellow);
    box-shadow: 0 0 0 3px rgba(255, 179, 15, 0.2);
}

.uad-button {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bleu-de-france);
    color: var(--baby-powder);
}

.uad-button:hover {
    background: var(--selective-yellow);
    color: var(--jet);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.uad-button:active {
    transform: translateY(0);
}

.uad-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.uad-button-secondary {
    background: white;
    color: var(--jet);
    border: 2px solid var(--jet);
}

.uad-button-secondary:hover {
    background: var(--jet);
    color: var(--baby-powder);
    border-color: var(--jet);
}

/* Loading State */
.uad-dashboard.uad-loading {
    opacity: 0.7;
    pointer-events: none;
}

.uad-dashboard.uad-loading::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--jet);
    color: var(--baby-powder);
    padding: 16px 32px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
}

/* Section Titles */
.uad-section-title {
    color: var(--jet);
    font-size: 20px;
    font-weight: 600;
    margin: 32px 0 16px 0;
    padding-left: 12px;
    border-left: 4px solid var(--bleu-de-france);
}

/* Chart Container */
.uad-chart-container {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 1px 4px rgba(45, 45, 42, 0.08);
}

#uad-activity-chart {
    max-height: 400px;
}

/* Table Container */
.uad-table-container {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(45, 45, 42, 0.08);
    overflow: hidden;
}

.uad-table-wrapper {
    overflow-x: auto;
    margin-top: 16px;
}

/* Table Styles */
.uad-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.uad-table thead {
    background: var(--steel);
    color: white;
}

.uad-table thead th {
    padding: 14px 12px;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--bleu-de-france);
}

.uad-top-link-label {
    font-size: 10px;
    font-weight: 400;
    text-transform: none;
    opacity: 0.9;
    font-family: 'Monaco', 'Courier New', monospace;
    letter-spacing: 0;
}

/* Add vertical separator lines */
.uad-table thead th:nth-child(4),
.uad-table tbody td:nth-child(4) {
    border-right: 2px solid var(--bleu-de-france);
}

.uad-table thead th:nth-child(7),
.uad-table tbody td:nth-child(7) {
    border-right: 2px solid var(--bleu-de-france);
}

.uad-table tbody tr {
    border-bottom: 1px solid rgba(45, 45, 42, 0.1);
    transition: background-color 0.2s ease;
}

.uad-table tbody tr:hover {
    background-color: rgba(48, 131, 220, 0.05);
}

.uad-table tbody tr:last-child {
    border-bottom: none;
}

.uad-table tbody td {
    padding: 12px;
    color: var(--jet);
    text-align: center;
}

/* Table Cell Alignments */
.uad-table .uad-date {
    font-weight: 500;
    color: var(--bleu-de-france);
    text-align: center;
}

.uad-table .uad-hits,
.uad-table .uad-cost,
.uad-table .uad-total,
.uad-table .uad-balance {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.uad-table .uad-hits {
    font-weight: 600;
    color: var(--selective-yellow);
}

.uad-table .uad-balance {
    font-weight: 700;
}

.uad-table .uad-balance.negative {
    color: var(--poppy);
}

.uad-table .uad-balance.positive {
    color: #28a745;
}

/* Highlight specific columns */
.uad-table tbody td.uad-nonsui,
.uad-table tbody td.uad-sui,
.uad-table tbody td.uad-other {
    color: #6c757d;
    font-style: italic;
    text-align: center;
}

/* Empty state */
.uad-no-data {
    background: white;
    border-radius: 8px;
    padding: 48px 24px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(45, 45, 42, 0.08);
}

.uad-no-data p {
    color: #6c757d;
    font-size: 16px;
    margin: 0;
}

/* Error message */
.uad-error {
    background-color: #fff3cd;
    border: 1px solid var(--poppy);
    border-radius: 6px;
    padding: 16px;
    margin: 20px 0;
}

.uad-error p {
    color: var(--poppy);
    margin: 0;
    font-weight: 500;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .uad-dashboard {
        padding: 16px;
    }

    .uad-date-picker {
        flex-direction: column;
        align-items: stretch;
    }

    .uad-date-input,
    .uad-button {
        width: 100%;
    }

    .uad-summary {
        grid-template-columns: 1fr;
    }

    .uad-table-wrapper {
        margin: 0 -24px;
        padding: 0 24px;
    }

    .uad-table {
        font-size: 12px;
    }

    .uad-table thead th,
    .uad-table tbody td {
        padding: 10px 8px;
    }

    .uad-chart-container {
        padding: 16px;
    }

    #uad-activity-chart {
        max-height: 300px;
    }
}

/* Table Header Controls */
.uad-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 16px;
}

.uad-table-header .uad-section-title {
    margin: 0;
}

.uad-table-info {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.uad-showing-entries {
    font-size: 14px;
    color: var(--jet);
}

.uad-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
}

.uad-per-page label {
    font-size: 14px;
    color: var(--jet);
    font-weight: 500;
}

.uad-select {
    padding: 6px 12px;
    border: 2px solid var(--bleu-de-france);
    border-radius: 4px;
    font-size: 14px;
    color: var(--jet);
    background: var(--baby-powder);
    cursor: pointer;
    transition: all 0.2s ease;
}

.uad-select:hover {
    border-color: var(--selective-yellow);
}

.uad-select:focus {
    outline: none;
    border-color: var(--selective-yellow);
    box-shadow: 0 0 0 3px rgba(255, 179, 15, 0.2);
}

/* Pagination Controls */
.uad-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(45, 45, 42, 0.1);
    flex-wrap: wrap;
}

.uad-page-btn {
    padding: 8px 16px;
    border: 2px solid var(--bleu-de-france);
    border-radius: 4px;
    background: white;
    color: var(--bleu-de-france);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.uad-page-btn:hover:not(:disabled) {
    background: var(--bleu-de-france);
    color: var(--baby-powder);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(48, 131, 220, 0.3);
}

.uad-page-btn:active:not(:disabled) {
    transform: translateY(0);
}

.uad-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #ccc;
    color: #999;
}

.uad-page-numbers {
    display: flex;
    gap: 6px;
    align-items: center;
}

.uad-page-num {
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    border: 2px solid var(--bleu-de-france);
    border-radius: 4px;
    background: white;
    color: var(--bleu-de-france);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.uad-page-num:hover {
    background: var(--bleu-de-france);
    color: var(--baby-powder);
    transform: scale(1.05);
}

.uad-page-num.active {
    background: var(--selective-yellow);
    border-color: var(--selective-yellow);
    color: var(--jet);
    cursor: default;
}

.uad-page-num.active:hover {
    transform: none;
}

.uad-page-ellipsis {
    padding: 0 8px;
    color: var(--jet);
    font-size: 14px;
    font-weight: 600;
}

@media screen and (max-width: 480px) {
    .uad-title {
        font-size: 22px;
    }

    .uad-section-title {
        font-size: 18px;
    }

    .uad-table {
        font-size: 11px;
    }

    .uad-table thead th {
        font-size: 10px;
        padding: 8px 6px;
    }

    .uad-table tbody td {
        padding: 8px 6px;
    }

    .uad-table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .uad-table-info {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .uad-per-page {
        flex-direction: column;
        align-items: stretch;
    }

    .uad-select {
        width: 100%;
    }

    .uad-pagination {
        gap: 4px;
    }

    .uad-page-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .uad-page-num {
        min-width: 32px;
        height: 32px;
        padding: 6px 8px;
        font-size: 12px;
    }

    .uad-page-btn span {
        display: none;
    }
}

/* Link Table Specific Styles */
.uad-link-table-container {
    margin-top: 32px;
}

.uad-link-summary {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: rgba(48, 131, 220, 0.05);
    border-radius: 6px;
    margin-bottom: 16px;
}

.uad-link-summary-item {
    font-size: 14px;
    color: var(--jet);
}

.uad-link-summary-item strong {
    color: var(--bleu-de-france);
    font-size: 18px;
    margin-right: 4px;
}

.uad-link-table .uad-link-id {
    font-weight: 500;
    color: var(--steel);
    text-align: center;
}

.uad-link-table .uad-keyword {
    text-align: left;
    font-family: 'Monaco', 'Courier New', monospace;
}

.uad-link-table .uad-keyword code {
    background: rgba(45, 213, 191, 0.1);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 13px;
    color: var(--selective-yellow);
    font-weight: 600;
}

.uad-link-table .uad-destination {
    text-align: left;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uad-destination-link {
    color: var(--bleu-de-france);
    text-decoration: none;
    transition: color 0.2s ease;
}

.uad-destination-link:hover {
    color: var(--selective-yellow);
    text-decoration: underline;
}

.uad-deleted-link {
    color: var(--steel);
    font-style: italic;
    opacity: 0.6;
}

@media screen and (max-width: 768px) {
    .uad-link-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .uad-link-table .uad-destination {
        max-width: 200px;
    }
}

@media screen and (max-width: 480px) {
    .uad-link-table .uad-keyword code {
        font-size: 11px;
        padding: 2px 6px;
    }

    .uad-link-table .uad-destination {
        max-width: 150px;
        font-size: 11px;
    }
}

/* QR Code Column Styles */
.uad-table .uad-qr,
.uad-table .uad-qr-hits {
    text-align: center;
    font-weight: 600;
    color: var(--bleu-de-france);
    background-color: rgba(48, 131, 220, 0.05);
}

/* QR Code Link Styles */
.uad-qr-link {
    color: var(--bleu-de-france);
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.uad-qr-link:hover {
    color: var(--selective-yellow);
    text-decoration-style: solid;
    transform: translateY(-1px);
}

.uad-qr-link code {
    background: rgba(45, 213, 191, 0.15);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--selective-yellow);
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid rgba(45, 213, 191, 0.3);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.uad-qr-link:hover code {
    background: rgba(45, 213, 191, 0.3);
    color: var(--bleu-de-france);
    border-color: var(--selective-yellow);
    box-shadow: 0 2px 4px rgba(45, 213, 191, 0.3);
    transform: scale(1.02);
}

.uad-qr-link code::after {
    content: ' ↗';
    font-size: 11px;
    opacity: 0.7;
    margin-left: 2px;
}

/* Keyword Link Styles */
.uad-keyword-link {
    color: var(--selective-yellow);
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.uad-keyword-link:hover {
    color: var(--bleu-de-france);
    text-decoration-style: solid;
    transform: translateY(-1px);
}

.uad-keyword-link code {
    transition: all 0.2s ease;
    border: 1px solid rgba(45, 213, 191, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.uad-keyword-link code::after {
    content: ' ↗';
    font-size: 10px;
    opacity: 0.6;
    margin-left: 2px;
}

.uad-keyword-link:hover code {
    background: rgba(48, 131, 220, 0.2);
    border-color: var(--bleu-de-france);
    box-shadow: 0 2px 4px rgba(48, 131, 220, 0.3);
    transform: scale(1.02);
}

.uad-keyword-link:hover code::after {
    opacity: 1;
}
