/* TTMenus Notifications - Dashboard Styles */

:root {
    --primary-color: #3b82f6;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

body.dashboard-body {
    background: var(--bg-color);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Bar Navigation */
.topbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 20px;
}

.logo {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    overflow-y: auto;
}

.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--bg-color);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Quick Actions */
.quick-actions {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Clients Container */
.clients-container {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.client-card {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.client-name {
    font-weight: 600;
    font-size: 1.125rem;
}

.client-domain {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* Analytics Cards */
.analytics-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    padding: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 12px;
}

.chart-subtitle {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 12px;
}

/* Metrics Grid */
/* Overview Stats */
.overview-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.overview-stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
}

.overview-stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.overview-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.overview-stat-detail {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Breakdown Grid */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    padding: 20px;
}

.breakdown-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 6px;
}

.breakdown-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.breakdown-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.metric-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.metric-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.metric-trend {
    font-size: 0.75rem;
    margin-top: 4px;
}

.trend-up {
    color: var(--success-color);
}

.trend-down {
    color: var(--danger-color);
}

/* Subscription Stats */
.subscription-stats {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.subscription-stat {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

/* Page Header with Actions */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Outcomes Table */
.table-container {
    overflow-x: auto;
}

.outcomes-table {
    width: 100%;
    border-collapse: collapse;
}

.outcomes-table thead {
    background: var(--bg-color);
}

.outcomes-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.outcomes-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.outcomes-table tbody tr:hover {
    background: var(--bg-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* History Cards */
.history-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.history-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.history-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.history-card-title-section {
    flex: 1;
    min-width: 0;
}

.history-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    word-wrap: break-word;
}

.history-card-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.history-card-badges {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.history-card-body {
    flex: 1;
    margin-bottom: 16px;
}

.history-card-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    word-wrap: break-word;
}

.history-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    gap: 12px;
}

.history-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* History Table (fallback for mobile or if needed) */
.history-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table thead {
    background: var(--bg-color);
}

.history-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.history-table tbody tr:hover {
    background: var(--bg-color);
}

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

.message-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-status-sent {
    background: #d1fae5;
    color: #065f46;
}

.badge-status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.badge-status-cancelled {
    background: #e5e7eb;
    color: #374151;
}

.badge-priority-low {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-priority-normal {
    background: #dbeafe;
    color: #1e40af;
}

.badge-priority-high {
    background: #fef3c7;
    color: #92400e;
}

.badge-priority-urgent {
    background: #fee2e2;
    color: #991b1b;
}

.badge-type-menu_update {
    background: #e0f2fe;
    color: #0c4a6e;
}

.badge-type-promotion {
    background: #fce7f3;
    color: #831843;
}

.badge-type-order {
    background: #f0fdf4;
    color: #14532d;
}

.badge-type-system {
    background: #f3f4f6;
    color: #1f2937;
}

.badge-type-general {
    background: #f9fafb;
    color: #4b5563;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Detail Sections */
.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.detail-item span {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Deliveries Table */
.deliveries-table-container {
    overflow-x: auto;
    margin-top: 16px;
}

.deliveries-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.deliveries-table thead {
    background: var(--bg-color);
}

.deliveries-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.deliveries-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.deliveries-table tbody tr:hover {
    background: var(--bg-color);
}

/* Filters Container */
.filters-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Subscribers Page */
.subscribers-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.subscribers-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.subscriber-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
    transition: box-shadow 0.2s;
}

.subscriber-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.subscriber-card.inactive {
    border-left-color: var(--secondary-color);
    opacity: 0.8;
}

.subscriber-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.subscriber-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.subscriber-title h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.subscriber-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-inactive {
    background: rgba(107, 114, 128, 0.1);
    color: var(--secondary-color);
}

.subscriber-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.subscriber-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu {
        display: flex;
        overflow-x: auto;
    }
    
    .nav-link {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .nav-link.active {
        border-left: none;
        border-bottom-color: var(--primary-color);
    }
    
    .content-area {
        padding: 16px;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .history-cards-container {
        grid-template-columns: 1fr;
    }
    
    .history-card-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .history-card-footer .btn {
        width: 100%;
        margin-top: 12px;
    }
}

