/* Global Scrollbar Stability & Hiding */
html {
    scrollbar-gutter: stable;
    scrollbar-width: none;
    /* Hide global for Firefox */
    -ms-overflow-style: none;
    /* Hide global for IE/Edge */
}

/* Hide global scrollbar for Chrome/Safari */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

body.dashboard-view {
    overflow-x: hidden;
    height: auto !important;
    position: relative;
    width: 100%;
}

body.dashboard-view main {
    height: auto !important;
    /* Fixed viewport height minus navbar */
    overflow: visible !important;
    padding-top: 130px !important;
}

/* Dashboard Shell - content area starts after the fixed sidebar */
.dashboard-shell {
    display: flex;
    min-height: calc(100vh - 130px);
    padding: 0;
    position: relative;
}

.dashboard-content {
    flex-grow: 1;
    min-width: 0;
    padding: 35px 40px;
    position: relative;
    z-index: 900;
    /* ensure content is above sidebar */
}

/* Fixed left sidebar - anchored to page edge, flush below navbar */
.dashboard-sidebar {
    position: sticky;
    top: 130px;
    /* Height of the navbar */
    width: 260px;
    min-width: 260px;
    height: calc(100vh - 130px);
    /* Fill remaining viewport height */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    background: linear-gradient(180deg, rgba(12, 12, 14, 0.98) 0%, rgba(8, 8, 10, 1) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 800;
    /* behind content */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 102, 0, 0.2) transparent;
}

.dashboard-sidebar::-webkit-scrollbar {
    display: block;
    width: 4px;
}

.dashboard-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 102, 0, 0.2);
    border-radius: 10px;
}

.dashboard-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* dashboard-content moved and updated above */

/* Sidebar Navigation Styling */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
    height: 100%;
}


.nav-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-group-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin-bottom: 5px;
    padding-left: 15px;
    opacity: 0.6;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 12px;
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--primary);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateX(5px);
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(255, 102, 0, 0.15) 0%, transparent 100%);
    color: var(--text-main);
    border-left: 3px solid var(--primary);
}

.sidebar-link.active i {
    color: var(--primary);
}

/* Main Dashboard Elements */
.page-header {
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, #a0a0a0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-header p {
    color: var(--text-dim);
    font-size: 1.1rem;
}

/* Mini Stats Grid */
.mini-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.mini-stat-card {
    background: linear-gradient(135deg, rgba(25, 25, 28, 0.8), rgba(15, 15, 18, 0.6));
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.mini-stat-card:hover {
    transform: translateY(-5px);
}

.icon-box {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.icon-box.purple {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.icon-box.orange {
    background: rgba(255, 102, 0, 0.15);
    color: #ff6600;
}

.icon-box.blue {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.icon-box.green {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.stat-info .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Professional Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 30px;
    align-items: start;
}

.grid-main,
.grid-side {
    min-width: 0;
}

@media (max-width: 1300px) {

    /* Increased from 1250 for more breathing room */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .grid-side {
        order: -1;
    }
}

/* Panel Card */
/* Ensure cards don't burst out of their grid cells */
.panel-card {
    min-width: 0;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(25, 25, 30, 0.8), rgba(10, 10, 12, 0.9));
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.panel-header h2,
.panel-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
}

.panel-header i {
    color: var(--primary);
}

/* Activity Feed */
.feed-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.feed-item:last-child {
    border: none;
}

.feed-item:hover {
    padding-left: 35px;
    background: rgba(255, 255, 255, 0.02);
}

.feed-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.feed-icon.ticket {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.feed-icon.order {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
}

.feed-content {
    flex: 1;
}

.feed-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-main);
}

.feed-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 15px;
}

.type-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.type-tag.ticket {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.type-tag.order {
    background: rgba(251, 146, 60, 0.2);
    color: #fdba74;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.completed,
.status-dot.open {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

.status-dot.pending {
    background: #eab308;
}

.feed-action {
    opacity: 0;
    color: var(--primary);
    transition: 0.3s;
}

.feed-item:hover .feed-action {
    opacity: 1;
}

/* Quick Actions Vertical */
.action-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: none;
    outline: none;
}

.btn-action i {
    z-index: 2;
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    transition: all 0.5s ease;
    z-index: 1;
}

.btn-action:hover::before {
    left: 200%;
}

.btn-action.primary {
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c42 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(255, 102, 0, 0.25);
    border: 1px solid rgba(255, 102, 0, 0.5);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-action.primary:hover {
    box-shadow: 0 10px 25px rgba(255, 102, 0, 0.4);
    transform: translateY(-2px);
}

.btn-action.secondary {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.btn-action.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.btn-action.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.25) 100%) !important;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-action.danger:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(239, 68, 68, 0.15);
}

/* Security Info */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-row:last-child {
    border: none;
}

.info-row .lbl {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.info-row .val {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
}

@media (max-width: 1024px) {
    .dashboard-shell {
        flex-direction: column;
        margin-left: 0;
        padding: 0;
    }

    .dashboard-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        height: auto;
        border-right: none;
    }

    .dashboard-content {
        padding: 20px;
    }
}


/* Standard Form Elements */
.standard-form .form-group {
    margin-bottom: 25px;
}

.standard-form label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 15px;
    color: var(--primary);
    opacity: 0.7;
}

.standard-form input,
.standard-form textarea,
.standard-form select {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 15px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.standard-form .input-wrapper input {
    padding-left: 45px;
}

.standard-form textarea {
    resize: vertical;
    padding: 15px;
}

.standard-form input:focus,
.standard-form textarea:focus,
.standard-form select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.1);
}

.btn-action.big {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

/* Helper Lists */
.clean-list {
    list-style: none;
    padding: 0;
}

.clean-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: var(--text-dim);
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.clean-list li:last-child {
    border: none;
}

.clean-list li i {
    color: var(--primary);
    font-size: 0.8rem;
}

/* Table Modern Styling */
.table-responsive-modern {
    overflow-x: auto;
    margin-top: 10px;
}

.grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.grid-table th {
    padding: 15px 20px;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
    letter-spacing: 1px;
}

.grid-table tr {
    transition: all 0.3s ease;
}

.grid-table td {
    background: rgba(255, 255, 255, 0.02);
    padding: 15px 20px;
    color: var(--text-main);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    word-break: break-word;
    /* Ensure long strings wrap */
    max-width: 300px;
}

.grid-table td:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.grid-table td:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.grid-table tr:hover td {
    background: rgba(255, 102, 0, 0.05);
    border-color: rgba(255, 102, 0, 0.2);
    transform: scale(1.002);
}

/* Chat & Messaging UI */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 35px;
}

.chat-bubble {
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.8), rgba(20, 20, 25, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    width: fit-content;
    max-width: 85%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-bubble.initial {
    border-top: 2px solid var(--primary);
    align-self: flex-start;
}

.chat-bubble.staff {
    border-left: 4px solid var(--secondary);
    align-self: flex-start;
}

.chat-bubble.user {
    border-right: 4px solid var(--primary);
    align-self: flex-end;
}

.bubble-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.bubble-header .author {
    font-weight: 700;
    color: var(--text-main);
}

.bubble-header .date {
    color: var(--text-dim);
}

.bubble-content {
    line-height: 1.6;
    color: var(--text-dim);
}

/* Status & Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.05);
}

.status-pill.big {
    padding: 8px 18px;
    font-size: 0.85rem;
}

.status-pill i {
    font-size: 0.5rem;
}

.status-pill.open {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.status-pill.pending {
    color: #eab308;
    background: rgba(234, 179, 8, 0.1);
}

.status-pill.closed,
.status-pill.resolved {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.breadcrumb a {
    text-decoration: none;
    color: var(--primary);
}

.breadcrumb i {
    font-size: 0.6rem;
    margin: 0 5px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 40px;
}

.empty-state i {
    font-size: 4rem;
    color: var(--primary);
    opacity: 0.2;
    margin-bottom: 20px;
    display: block;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 15px;
}

.empty-state p {
    color: var(--text-dim);
    margin-bottom: 30px;
}

/* Helpers */
.btn-text {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.3s;
}

.btn-text:hover {
    opacity: 0.8;
}

.btn-text.danger {
    color: #ef4444;
}

.status-dot.open {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

.status-dot.closed {
    background: #64748b;
}

/* Settings & List Specifics */
.settings-stack {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.inline-settings-form .form-group-flex {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.inline-settings-form .form-group-flex .form-group {
    flex: 1;
    margin-bottom: 0;
}

.btn-action.mini {
    padding: 10px 15px;
    font-size: 0.8rem;
}

.form-divider {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin: 25px 0;
}

.price-summary-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--text-dim);
}

.summary-row.total {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: 15px;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.1rem;
}

.summary-row.discount {
    color: var(--primary);
    font-weight: 600;
}

.anniversary-promo {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(90deg, rgba(255, 102, 0, 0.1), transparent);
    border-left: 4px solid var(--primary);
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
}

.promo-icon i {
    font-size: 1.8rem;
    color: var(--primary);
}

.license-key-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 102, 0, 0.1);
}

.license-key-display.mini {
    padding: 2px 8px;
    font-size: 0.75rem;
}

.license-list .feed-item {
    cursor: default;
}

.license-list .feed-icon.open {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.license-list .feed-icon.closed {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.status-pill.mini {
    padding: 2px 8px;
    font-size: 0.6rem;
}

.user-list-item .feed-icon.admin {
    background: rgba(255, 102, 0, 0.1);
    color: var(--primary);
}

.user-list-item .feed-icon.user {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.badge.mini {
    padding: 2px 6px;
    font-size: 0.65rem;
}

.text-dim {
    color: var(--text-dim) !important;
}

.mini-text {
    font-size: 0.75rem;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

@media (max-width: 768px) {
    .inline-settings-form .form-group-flex {
        flex-direction: column;
        align-items: stretch;
    }
}

.no-sidebar {
    grid-template-columns: 1fr !important;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}