/* ============================================================
   TODOSIGN PREMIUM LIST VIEW
   A unified, sophisticated list design for all pages
   ============================================================ */

/* ==================== CSS VARIABLES ==================== */
:root {
    /* List View Design Tokens */
    --list-bg: rgba(15, 23, 42, 0.6);
    --list-border: rgba(148, 163, 184, 0.1);
    --list-header-bg: rgba(30, 41, 59, 0.8);
    --list-row-hover: rgba(59, 130, 246, 0.08);
    --list-row-border: rgba(148, 163, 184, 0.06);
    --list-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --list-radius: 20px;

    /* Row Animation */
    --row-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --list-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light Mode Overrides */
[data-theme="light"] {
    --list-bg: rgba(255, 255, 255, 0.95);
    --list-border: rgba(226, 232, 240, 0.8);
    --list-header-bg: rgba(248, 250, 252, 0.95);
    --list-row-hover: rgba(59, 130, 246, 0.06);
    --list-row-border: rgba(226, 232, 240, 0.6);
    --list-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ==================== MAIN CONTAINER ==================== */
.premium-list {
    background: var(--list-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--list-border);
    border-radius: var(--list-radius);
    box-shadow: var(--list-shadow);
    overflow: hidden;
    font-family: var(--list-font);
    position: relative;
}

/* Subtle top gradient line */
.premium-list::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-primary, #3b82f6) 20%,
        var(--accent-primary, #3b82f6) 80%,
        transparent 100%
    );
    opacity: 0.5;
}

/* ==================== TABLE STRUCTURE ==================== */
.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

/* ==================== HEADER ==================== */
.premium-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.premium-table thead tr {
    background: var(--list-header-bg);
}

.premium-table th {
    padding: 18px 24px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--list-border);
    white-space: nowrap;
    position: relative;
}

/* Header column dividers */
.premium-table th:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 1px;
    background: var(--list-row-border);
}

/* Checkbox column */
.premium-table th.col-checkbox,
.premium-table td.col-checkbox {
    width: 50px;
    text-align: center;
    padding-left: 20px;
    padding-right: 12px;
}

/* Actions column */
.premium-table th.col-actions,
.premium-table td.col-actions {
    width: 140px;
    min-width: 140px;
    text-align: right;
    padding-right: 24px;
}

/* ==================== TABLE BODY ==================== */
.premium-table tbody tr {
    transition: var(--row-transition);
    position: relative;
}

.premium-table tbody tr::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary, #3b82f6);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.premium-table tbody tr:hover {
    background: var(--list-row-hover);
}

.premium-table tbody tr:hover::before {
    opacity: 1;
}

.premium-table td {
    padding: 20px 24px;
    border-bottom: 1px solid var(--list-row-border);
    color: var(--text-primary, #f8fafc);
    font-size: 0.9rem;
    vertical-align: middle;
    transition: var(--row-transition);
}

.premium-table tbody tr:last-child td {
    border-bottom: none;
}

/* ==================== CELL TYPES ==================== */
/* Primary Cell - Nome/Title */
.cell-primary {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cell-primary-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: var(--row-transition);
}

/* Icon variants by page */
.cell-primary-icon.icon-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
    color: #3b82f6;
}

.cell-primary-icon.icon-purple {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.1));
    color: #6366f1;
}

.cell-primary-icon.icon-emerald {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    color: #10b981;
}

.cell-primary-icon.icon-cyan {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.1));
    color: #06b6d4;
}

.cell-primary-icon.icon-amber {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
    color: #f59e0b;
}

/* Avatar Icon */
.cell-primary-icon.icon-avatar {
    background: linear-gradient(135deg, var(--accent-primary, #6366f1), #6366f1);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Indigo Icon (Notes/Folders) */
.cell-primary-icon.icon-indigo {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.1));
    color: #6366f1;
}

.premium-table tbody tr:hover .cell-primary-icon {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cell-primary-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.cell-primary-title {
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color 0.2s ease;
}

.premium-table tbody tr:hover .cell-primary-title {
    color: var(--accent-primary, #3b82f6);
}

.cell-primary-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Secondary Text Cell */
.cell-secondary {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Date Cell */
.cell-date {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cell-date-value {
    font-size: 0.875rem;
    color: var(--text-primary, #f8fafc);
    font-weight: 500;
}

.cell-date-label {
    font-size: 0.7rem;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==================== BADGES ==================== */
.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: var(--row-transition);
}

/* Status Badges */
.premium-badge.status-active,
.premium-badge.status-pendente {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.premium-badge.status-completed,
.premium-badge.status-concluido {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.premium-badge.status-cancelled,
.premium-badge.status-cancelado {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.premium-badge.status-draft,
.premium-badge.status-rascunho {
    background: rgba(100, 116, 139, 0.12);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.25);
}

/* Category Badges */
.premium-badge.category-cliente {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.premium-badge.category-parceiro {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.premium-badge.category-interno {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Variable Badge (Templates) */
.premium-badge.variables {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: none;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.7rem;
}

.premium-badge i {
    font-size: 0.7rem;
}

/* ==================== ACTION BUTTONS ==================== */
.premium-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.premium-table tbody tr:hover .premium-actions {
    opacity: 1;
}

.premium-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary, #94a3b8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--row-transition);
    font-size: 0.85rem;
}

.premium-action-btn:hover {
    background: var(--accent-primary, #3b82f6);
    color: white;
    border-color: var(--accent-primary, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.premium-action-btn.btn-edit:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.premium-action-btn.btn-delete:hover {
    background: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.premium-action-btn.btn-view:hover {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.premium-action-btn.btn-favorite {
    color: var(--text-secondary, #94a3b8);
}

.premium-action-btn.btn-favorite:hover,
.premium-action-btn.btn-favorite.active {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
}

/* ==================== CHECKBOX ==================== */
.premium-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid var(--list-border);
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: var(--row-transition);
    position: relative;
}

.premium-checkbox:hover {
    border-color: var(--accent-primary, #3b82f6);
}

.premium-checkbox:checked {
    background: var(--accent-primary, #3b82f6);
    border-color: var(--accent-primary, #3b82f6);
}

.premium-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ==================== EMPTY STATE ==================== */
.premium-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.premium-list-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(99, 102, 241, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.premium-list-empty-icon i {
    font-size: 2rem;
    color: var(--accent-primary, #3b82f6);
    opacity: 0.7;
}

.premium-list-empty h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
    margin: 0 0 8px 0;
}

.premium-list-empty p {
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
    margin: 0;
    max-width: 300px;
}

/* ==================== LOADING STATE ==================== */
.premium-list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
}

.premium-list-loading i {
    font-size: 2rem;
    color: var(--accent-primary, #3b82f6);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .premium-table th,
    .premium-table td {
        padding: 16px 18px;
    }

    .cell-primary-icon {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 992px) {
    .premium-table th,
    .premium-table td {
        padding: 14px 14px;
    }

    .premium-table th.col-hide-md,
    .premium-table td.col-hide-md {
        display: none;
    }
}

@media (max-width: 768px) {
    .premium-list {
        border-radius: 16px;
    }

    .premium-table th,
    .premium-table td {
        padding: 12px 12px;
    }

    .premium-table th.col-hide-sm,
    .premium-table td.col-hide-sm {
        display: none;
    }

    .cell-primary-icon {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .premium-action-btn {
        width: 30px;
        height: 30px;
    }
}

/* ==================== LIGHT MODE REFINEMENTS ==================== */
[data-theme="light"] .premium-table th {
    color: #64748b;
}

[data-theme="light"] .premium-table td {
    color: #1e293b;
}

[data-theme="light"] .cell-primary-title {
    color: #0f172a;
}

[data-theme="light"] .cell-secondary {
    color: #64748b;
}

[data-theme="light"] .premium-action-btn {
    background: rgba(0, 0, 0, 0.06);
    color: #475569;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .premium-action-btn:hover {
    color: white;
}

[data-theme="light"] .premium-actions {
    opacity: 0.8;
}

[data-theme="light"] .premium-list-empty h3 {
    color: #0f172a;
}

[data-theme="light"] .premium-list-empty p {
    color: #64748b;
}

/* ==================== PAGE-SPECIFIC ACCENT COLORS ==================== */
/* Documents - Blue */
.page-documents .premium-list::before,
.page-documents .premium-table tbody tr:hover::before {
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
}

.page-documents .premium-table tbody tr:hover .cell-primary-title {
    color: #3b82f6;
}

/* Contacts - Purple */
.page-contacts .premium-list::before {
    background: linear-gradient(90deg, transparent, #6366f1, transparent);
}

.page-contacts .premium-table tbody tr::before {
    background: #6366f1;
}

.page-contacts .premium-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.08);
}

.page-contacts .premium-table tbody tr:hover .cell-primary-title {
    color: #6366f1;
}

/* Templates - Emerald */
.page-templates .premium-list::before {
    background: linear-gradient(90deg, transparent, #10b981, transparent);
}

.page-templates .premium-table tbody tr::before {
    background: #10b981;
}

.page-templates .premium-table tbody tr:hover {
    background: rgba(16, 185, 129, 0.08);
}

.page-templates .premium-table tbody tr:hover .cell-primary-title {
    color: #10b981;
}

/* To-Sign - Amber/Orange */
.page-to-sign .premium-list::before {
    background: linear-gradient(90deg, transparent, #f59e0b, transparent);
}

.page-to-sign .premium-table tbody tr::before {
    background: #f59e0b;
}

.page-to-sign .premium-table tbody tr:hover {
    background: rgba(245, 158, 11, 0.08);
}

.page-to-sign .premium-table tbody tr:hover .cell-primary-title {
    color: #f59e0b;
}

/* Notes/Folders - Indigo */
.page-notes .premium-list::before {
    background: linear-gradient(90deg, transparent, #6366f1, transparent);
}

.page-notes .premium-table tbody tr::before {
    background: #6366f1;
}

.page-notes .premium-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.08);
}

.page-notes .premium-table tbody tr:hover .cell-primary-title {
    color: #6366f1;
}
