/* ========================================
   USAGE DASHBOARD PAGE
   ======================================== */

.usage-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.usage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    background: var(--background-primary);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.usage-header .header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.usage-header .header-logo {
    height: 32px;
    width: auto;
}

.usage-main {
    flex: 1;
    padding: var(--space-8) var(--space-6);
    background: var(--background-secondary);
}

.usage-content {
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.page-header-text {
    flex: 1;
}

.btn-export {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}


/* Usage Cards */
.usage-card {
    background: var(--background-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

/* Filters Card */
.filters-card {
    border: 1px solid var(--border-light);
}

.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.filters-header .card-title {
    margin-bottom: 0;
}

.filter-icon {
    font-size: 1rem;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-select,
.filter-input {
    padding: var(--space-3) var(--space-4);
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--background-primary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(var(--brand-primary-rgb), 0.15);
}

.filter-actions {
    justify-content: flex-end;
}

.filter-actions .btn {
    width: 100%;
}

/* Table Header */
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.record-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 var(--space-3);
    background: var(--background-secondary);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Usage Table */
.usage-table-container {
    overflow: auto;
    max-height: 600px;
}

.usage-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.usage-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--background-primary);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

.usage-table td {
    padding: var(--space-4);
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    background: var(--background-primary);
}

.usage-table tbody tr {
    transition: background var(--transition-fast);
}

.usage-table tbody tr:hover td {
    background: var(--background-secondary);
}

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

/* User Cell */
.user-cell .user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--background-tertiary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    vertical-align: middle;
    margin-right: var(--space-3);
}

.user-cell .user-info {
    display: inline-block;
    vertical-align: middle;
}

.user-cell .user-name {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
}

.user-cell .user-email {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Template Badge */
.template-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--background-secondary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-completed {
    background: rgba(var(--success-500-rgb), 0.1);
    color: var(--success);
}

.status-processing {
    background: rgba(var(--info-500-rgb), 0.1);
    color: var(--info);
}

.status-failed {
    background: rgba(var(--error-500-rgb), 0.1);
    color: var(--error);
}

/* Date Cell */
.date-cell .date-value {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
}

.date-cell .time-value {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.no-date {
    color: var(--text-muted);
    font-size: 1.125rem;
}

/* Credits Cell */
.credits-cell {
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Table Footer */
.table-footer {
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-4);
}

.table-note {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

/* Responsive Usage Dashboard */
@media (max-width: 1024px) {
    .filter-row {
        grid-template-columns: 1fr 1fr;
    }

    .filter-row:last-child {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .usage-header {
        padding: var(--space-3) var(--space-4);
    }

    .usage-header .header-center {
        position: static;
        transform: none;
    }

    .usage-header .header-left {
        order: 1;
    }

    .usage-header .header-center {
        order: 2;
        flex: 1;
        text-align: center;
    }

    .usage-header .header-right {
        order: 3;
    }

    .usage-main {
        padding: var(--space-6) var(--space-4);
    }

    .page-header {
        flex-direction: column;
        gap: var(--space-4);
    }

    .btn-export {
        width: 100%;
        justify-content: center;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .filter-row:last-child {
        grid-template-columns: 1fr;
    }

    .usage-card {
        padding: var(--space-4);
    }

    .usage-table-container {
        max-height: 400px;
    }

    .usage-table th:nth-child(5),
    .usage-table td:nth-child(5) {
        display: none;
    }
}

@media (max-width: 480px) {
    .usage-table th:nth-child(2),
    .usage-table td:nth-child(2),
    .usage-table th:nth-child(4),
    .usage-table td:nth-child(4) {
        display: none;
    }

    .user-cell {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.6875rem;
    }
}

/* Responsive Team Management */
@media (max-width: 768px) {
    .team-header {
        padding: var(--space-3) var(--space-4);
    }

    .team-header .header-center {
        position: static;
        transform: none;
    }

    .team-header .header-left {
        order: 1;
    }

    .team-header .header-center {
        order: 2;
        flex: 1;
        text-align: center;
    }

    .team-header .header-right {
        order: 3;
    }

    .org-badge {
        display: none;
    }

    .team-main {
        padding: var(--space-6) var(--space-4);
    }

    .page-title {
        font-size: 1.5rem;
    }

    .team-card {
        padding: var(--space-4);
    }

    .invite-form .form-row {
        grid-template-columns: 1fr;
    }

    .team-table th,
    .team-table td {
        padding: var(--space-3);
    }

    .team-table th:nth-child(3),
    .team-table td:nth-child(3) {
        display: none;
    }

    .invite-link-container {
        flex-direction: column;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .btn {
        width: 100%;
    }
}
