/* Subscription Dashboard Styles */

:root {
    --z2u-blue: #00A0DF;
    --z2u-grey: #2c3e50;
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --danger-red: #ef4444;
    --pending-blue: #3b82f6;
    --purple: #8b5cf6;
}

.dashboard-main {
    min-height: 100vh;
    background: #f8f9fa;
    padding: 200px 20px 40px;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content h1 {
    font-size: 32px;
    color: var(--z2u-grey);
    margin: 0 0 5px 0;
}

.subtitle {
    color: #6b7280;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-refresh,
.btn-export {
    padding: 10px 20px;
    border: 2px solid var(--z2u-blue);
    background: white;
    color: var(--z2u-blue);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh:hover,
.btn-export:hover {
    background: var(--z2u-blue);
    color: white;
}

.refresh-icon {
    font-size: 18px;
    display: inline-block;
    transition: transform 0.3s;
}

.btn-refresh:hover .refresh-icon {
    transform: rotate(180deg);
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 40px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--z2u-blue) 0%, #0088b8 100%);
    border-radius: 12px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--z2u-grey);
}

/* Breakdown Section */
.breakdown-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.breakdown-section h3 {
    font-size: 20px;
    color: var(--z2u-grey);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.breakdown-card {
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.breakdown-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 600;
}

.breakdown-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--z2u-grey);
    margin-bottom: 10px;
}

.breakdown-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--z2u-blue) 0%, #0088b8 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Filters */
.filters-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--z2u-grey);
}

.filter-group input,
.filter-group select {
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--z2u-blue);
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

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

.subscriptions-table thead {
    background: linear-gradient(135deg, var(--z2u-blue) 0%, #0088b8 100%);
    color: white;
}

.subscriptions-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.subscriptions-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.subscriptions-table tbody tr:hover {
    background: #f9fafb;
}

.subscriptions-table td {
    padding: 15px;
    font-size: 14px;
    color: var(--z2u-grey);
}

.loading {
    text-align: center;
    padding: 40px !important;
    color: #6b7280;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-pending {
    background: #dbeafe;
    color: var(--pending-blue);
}

.status-recurring {
    background: #d1fae5;
    color: var(--success-green);
}

.status-completed {
    background: #e0e7ff;
    color: var(--purple);
}

.status-on-hold {
    background: #fee2e2;
    color: var(--danger-red);
}

.payment-succeeded {
    background: #d1fae5;
    color: var(--success-green);
}

.payment-subscription {
    background: #e0e7ff;
    color: #6366f1;
}

/* Subscription Type Badges */
.subscription-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.subscription-weekly {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fbbf24;
}

.subscription-fortnightly {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border: 1px solid #60a5fa;
}

.subscription-monthly {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #34d399;
}

.subscription-quarterly {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
    border: 1px solid #818cf8;
}

.subscription-six-months {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #9f1239;
    border: 1px solid #f472b6;
}

/* Action Buttons */
.btn-view {
    padding: 6px 12px;
    background: var(--z2u-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-view:hover {
    background: #0088b8;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    color: var(--z2u-grey);
    margin-bottom: 10px;
}

.empty-state p {
    color: #6b7280;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;
    color: var(--z2u-grey);
}

.modal-close {
    background: none;
    border: none;
    font-size: 30px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    color: var(--z2u-grey);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #0088b8;
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--z2u-grey);
}

.btn-secondary:hover {
    background: #d1d5db;
}

/* Subscription Details */
.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    font-size: 18px;
    color: var(--z2u-grey);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--z2u-blue);
}

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

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

.detail-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
}

.detail-value {
    font-size: 14px;
    color: var(--z2u-grey);
}

.subscription-info-highlight {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 2px solid var(--z2u-blue);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.subscription-info-highlight .detail-grid {
    grid-template-columns: 1fr 1fr;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters-section {
        grid-template-columns: 1fr;
    }

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

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

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

    .subscriptions-table th,
    .subscriptions-table td {
        padding: 10px 8px;
    }

    /* Stack table for mobile */
    .subscriptions-table thead {
        display: none;
    }

    .subscriptions-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 15px;
    }

    .subscriptions-table td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border: none;
    }

    .subscriptions-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
    }

    .subscription-info-highlight .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Weekly View Styles */
.week-range {
    font-size: 14px;
    color: #6b7280;
    margin-top: 5px;
}

/* Daily Breakdown */
.breakdown-section {
    margin-bottom: 30px;
}

.daily-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.daily-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.daily-card.today {
    border-color: var(--z2u-blue);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

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

.daily-day {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.daily-date {
    font-size: 32px;
    font-weight: 700;
    color: var(--z2u-grey);
    margin-bottom: 5px;
}

.daily-count {
    font-size: 14px;
    color: #6b7280;
}

.daily-card.today .daily-day {
    color: var(--z2u-blue);
}

.daily-card.today .daily-date {
    color: var(--z2u-blue);
}

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

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

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

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

.badge-warning {
    background: #fed7aa;
    color: #92400e;
}

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

.badge-secondary {
    background: #e5e7eb;
    color: #6b7280;
}

.day-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}

/* Table Adjustments for Weekly View */
.subscriptions-table small {
    font-size: 11px;
    color: #6b7280;
}

.subscriptions-table td {
    vertical-align: top;
}

/* Responsive adjustments for daily grid */
@media (max-width: 768px) {
    .daily-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .daily-card {
        padding: 15px 10px;
    }
    
    .daily-date {
        font-size: 24px;
    }
}
