/* ===================================================
   TAPSO - Panel/Dashboard Pages Styles
   (Dashboard, Analytics, Settings, Support, etc.)
   =================================================== */

/* Panel Layout */
.panel-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.panel-sidebar {
    width: 16rem;
    background: var(--surface-light);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    z-index: var(--z-sticky);
}

.dark .panel-sidebar {
    background: var(--surface-dark);
    border-color: var(--border-color);
}

/* Sidebar User Profile */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    background: var(--background-light);
}

.dark .sidebar-profile {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow-sm);
}

/* Sidebar Navigation */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

    .sidebar-nav-item:hover {
        background: var(--background-light);
        color: var(--text-main);
    }

.dark .sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-nav-item.active {
    background: rgba(91, 19, 236, 0.1);
    color: var(--primary);
}

    .sidebar-nav-item.active .material-symbols-outlined {
        color: var(--primary);
    }

/* Panel Header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--surface-light);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.dark .panel-header {
    background: var(--surface-dark);
    border-color: var(--border-color);
}

/* Panel Main Content */
.panel-main {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    background: var(--background-light);
}

.dark .panel-main {
    background: var(--background-dark);
}

/* Stats Cards */
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--surface-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}

    .stat-card:hover {
        box-shadow: var(--shadow-md);
    }

.dark .stat-card {
    background: var(--surface-dark);
    border-color: var(--border-color);
}

.stat-card-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.dark .stat-card-value {
    color: white;
}

.stat-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
}

    .stat-card-trend.positive {
        color: var(--success);
        background: var(--success-bg);
    }

    .stat-card-trend.negative {
        color: var(--error);
        background: var(--error-bg);
    }

/* Dashboard Cards Grid */
.dashboard-cards-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .dashboard-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .dashboard-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Business Card Preview */
.card-preview {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.card-preview-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.card-preview:hover .card-preview-image {
    transform: scale(1.05);
}

.card-preview-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

    .card-preview-badge.active {
        background: #dcfce7;
        color: #166534;
    }

    .card-preview-badge.draft {
        background: #f3f4f6;
        color: #374151;
    }

/* Create New Card Button */
.create-card-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 280px;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
}

    .create-card-btn:hover {
        background: rgba(91, 19, 236, 0.05);
        border-color: var(--primary);
    }

.dark .create-card-btn {
    background: var(--surface-dark);
    border-color: #4a4759;
}

    .dark .create-card-btn:hover {
        background: rgba(91, 19, 236, 0.1);
    }

/* Data Table */
.data-table {
    width: 100%;
    text-align: right;
    font-size: 0.875rem;
}

    .data-table thead {
        background: #f8f9fa;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        font-weight: 500;
    }

.dark .data-table thead {
    background: var(--surface-dark);
}

.data-table th,
.data-table td {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
}

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

    .data-table tbody tr:hover {
        background: #fafafa;
    }

.dark .data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

    .status-badge.success {
        background: #dcfce7;
        color: #166534;
    }

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

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

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

.dark .status-badge.success {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
}

.dark .status-badge.warning {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
}

.dark .status-badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.dark .status-badge.info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* Subscription Card */
.subscription-card {
    background: linear-gradient(135deg, #1e1b2e 0%, #2d2a3b 100%);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

    .subscription-card::before {
        content: '';
        position: absolute;
        top: -2rem;
        left: -2rem;
        width: 8rem;
        height: 8rem;
        background: rgba(91, 19, 236, 0.3);
        border-radius: 50%;
        filter: blur(40px);
    }

    .subscription-card::after {
        content: '';
        position: absolute;
        bottom: -2rem;
        right: -2rem;
        width: 10rem;
        height: 10rem;
        background: rgba(139, 92, 246, 0.2);
        border-radius: 50%;
        filter: blur(60px);
    }

/* Chart Container */
.chart-container {
    background: var(--surface-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.dark .chart-container {
    background: var(--surface-dark);
    border-color: var(--border-color);
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.25rem;
    height: 12rem;
}

.bar-chart-item {
    flex: 1;
    background: rgba(91, 19, 236, 0.1);
    border-radius: 2px 2px 0 0;
    transition: all var(--transition-normal);
    cursor: pointer;
}

    .bar-chart-item:hover {
        background: rgba(91, 19, 236, 0.3);
    }

.dark .bar-chart-item {
    background: rgba(91, 19, 236, 0.2);
}

    .dark .bar-chart-item:hover {
        background: rgba(91, 19, 236, 0.4);
    }

/* Settings Section */
.settings-section {
    background: var(--surface-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-sm);
}

.dark .settings-section {
    background: var(--surface-dark);
    border-color: var(--border-color);
}

.settings-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
}

.dark .settings-section-header {
    border-color: var(--border-color);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    background: #e5e7eb;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-normal);
}

    .toggle-switch.active {
        background: var(--primary);
    }

    .toggle-switch::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 1.25rem;
        height: 1.25rem;
        background: white;
        border-radius: 50%;
        transition: transform var(--transition-normal);
        box-shadow: var(--shadow-sm);
    }

    .toggle-switch.active::after {
        transform: translateX(1.25rem);
    }

/* Support Chat */
.chat-message {
    max-width: 85%;
    padding: 1rem;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    line-height: 1.6;
}

    .chat-message.user {
        background: var(--surface-light);
        border: 1px solid var(--border-light);
        border-top-right-radius: 0;
        margin-left: auto;
    }

    .chat-message.agent {
        background: var(--primary);
        color: white;
        border-bottom-left-radius: 0;
        margin-right: auto;
    }

.dark .chat-message.user {
    background: var(--surface-dark);
    border-color: var(--border-color);
}

/* Mobile Phone Preview */
.phone-preview {
    position: relative;
    width: 340px;
    height: 700px;
    background: #1f2937;
    border: 14px solid #1f2937;
    border-radius: 2.5rem;
    box-shadow: var(--shadow-2xl);
}

.phone-preview-screen {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    border-radius: 2rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.phone-preview-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 28px;
    background: #1f2937;
    border-radius: 0 0 1rem 1rem;
}

/* Danger Zone */
.danger-zone {
    border: 1px solid #fecaca;
    border-radius: var(--radius-xl);
    padding: 1.5rem 2rem;
    background: rgba(254, 202, 202, 0.1);
}

.dark .danger-zone {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

/* Ticket List Item */
.ticket-item {
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

    .ticket-item:hover {
        border-color: var(--border-color);
        background: #fafafa;
    }

    .ticket-item.active {
        border-color: rgba(91, 19, 236, 0.3);
        background: rgba(91, 19, 236, 0.05);
    }

.dark .ticket-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.dark .ticket-item.active {
    background: rgba(91, 19, 236, 0.1);
}

/* Upgrade Plan Cards */
.plan-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    transition: box-shadow var(--transition-normal);
}

    .plan-card:hover {
        box-shadow: var(--shadow-lg);
    }

    .plan-card.featured {
        border: 2px solid var(--primary);
        box-shadow: var(--shadow-xl);
        transform: scale(1.05);
        position: relative;
        z-index: 1;
    }

        .plan-card.featured::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 6px;
            background: var(--primary);
        }

.dark .plan-card {
    background: var(--surface-dark);
}

/* Panel Footer */
.panel-footer {
    border-top: 1px solid var(--border-light);
    background: var(--surface-light);
    margin-top: auto;
}

.dark .panel-footer {
    background: var(--surface-dark);
    border-color: var(--border-color);
}

.panel-footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}

@media (min-width: 768px) {
    .panel-footer-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
}

.panel-footer-copyright {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

.dark .panel-footer-copyright {
    color: #6b7280;
}

.panel-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

@media (min-width: 768px) {
    .panel-footer-links {
        justify-content: flex-end;
    }
}

.panel-footer-link {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

    .panel-footer-link:hover {
        color: var(--primary);
    }

.dark .panel-footer-link {
    color: #a09eb0;
}

    .dark .panel-footer-link:hover {
        color: var(--primary);
    }


.custom-select {
    direction: rtl;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='20' viewBox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M5.516 7.548l4.484 4.484 4.484-4.484-1.06-1.06-3.424 3.423-3.424-3.423z'/></svg>");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    background-size: 16px;
    padding-left: 2.5rem;
}