/* =========================================
   ANALYTICS / MARKETING SUB MENU (SIDEBAR)
========================================= */

#analyticsMenu {
    position: relative;
    transition: 0.3s;
}

#analyticsMenu:hover {
    background: rgba(255,255,255,0.05);
}

#analyticsSubMenu {
    display: none;
    margin-top: 8px;
    padding-left: 10px;
    animation: fadeInMenu 0.25s ease;
}

#analyticsSubMenu.open {
    display: block;
}

#analyticsSubMenu li {
    list-style: none;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 10px;
    background: rgba(37,99,235,0.08);
    color: #d1d5db;
    font-size: 13px;
    cursor: pointer;
    transition: 0.25s;
}

#analyticsSubMenu li:hover {
    background: #2563eb;
    color: #fff;
    transform: translateX(3px);
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}


/* =========================================
   HEADER
========================================= */

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #111827;
    color: #fff;
    border-radius: 12px;
    margin: 10px;
}


/* =========================================
   3-COLUMN GRID CARDS (MAIN FIX)
========================================= */


.analytics-card h3 {
    font-size: 13px;
    margin: 0;
    color: #6b7280;
}

.analytics-card .value {
    font-size: 20px;
    font-weight: bold;
    margin-top: 5px;
}


/* STATUS COLORS */

.card-success { border-left-color: #22c55e; }
.card-success .value { color: #22c55e; }

.card-error { border-left-color: #ef4444; }
.card-error .value { color: #ef4444; }

.card-warning { border-left-color: #f59e0b; }
.card-warning .value { color: #f59e0b; }


/* =========================================
   SCROLLABLE SMALL TABS (BOTTOM STYLE)
========================================= */

/* =========================================
   ANALYTICS CARDS GRID FIX
========================================= */

.analytics-grid{
    display: grid !important;

    /* 3 cards in one row */
    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 12px;

    padding: 10px;

    align-items: stretch;
}

/* CARD STYLE */
.analytics-card{
    width: 100%;
    min-width: 0;

    background: #fff;

    border-radius: 14px;

    padding: 14px;

    box-sizing: border-box;

    box-shadow: 0 4px 12px rgba(0,0,0,0.06);

    border-left: 4px solid #2563eb;

    transition: 0.2s;
}

/* REMOVE OLD MARGIN */
.analytics-card{
    margin: 0 !important;
}

/* HOVER */
.analytics-card:hover{
    transform: translateY(-2px);
}


/* =========================================
   SMALL SCROLLABLE TABS FIX
========================================= */

.analytics-tabs-wrapper{

    width: 100%;

    overflow-x: auto;

    overflow-y: hidden;

    padding: 0 10px 10px;

    box-sizing: border-box;

    -webkit-overflow-scrolling: touch;

    scrollbar-width: none;
}

.analytics-tabs-wrapper::-webkit-scrollbar{
    display: none;
}

/* TABS ROW */
.analytics-tabs{

    display: flex !important;

    flex-wrap: nowrap !important;

    align-items: center;

    gap: 8px;

    width: max-content;

    min-width: 100%;

    padding: 2px;
}

/* SMALL TABS */
.analytics-tabs .tab{

    flex: 0 0 auto !important;

    width: auto !important;

    min-width: auto !important;

    max-width: none !important;

    padding: 7px 12px;

    border: none;

    border-radius: 14px;

    background: #1f2937;

    color: #9ca3af;

    font-size: 12px;

    font-weight: 600;

    white-space: nowrap;

    cursor: pointer;

    transition: 0.2s;
}

/* ACTIVE TAB */
.analytics-tabs .tab.active{
    background: #2563eb;
    color: #fff;
}


/* =========================================
   RESPONSIVE
========================================= */

/* TABLET */
@media(max-width: 900px){

    .analytics-grid{

        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}

/* MOBILE */
@media(max-width: 600px){

    /* KEEP 3 CARDS IN ROW */
    .analytics-grid{

        grid-template-columns: repeat(3, minmax(90px,1fr));

        gap: 8px;
    }

    .analytics-card{

        padding: 10px;

        border-radius: 12px;
    }

    .analytics-card h3{

        font-size: 11px;
    }

    .analytics-card .value{

        font-size: 16px;
    }

    /* SMALL MOBILE TABS */
    .analytics-tabs .tab{

        padding: 6px 10px;

        font-size: 11px;
    }
}
/* =========================================
   TAB PANELS
========================================= */

.tab-panel {
    padding: 10px;
}


/* =========================================
   SETTINGS UI
========================================= */

.settings-card {
    background: #fff;
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}


/* TOGGLE SWITCH */

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-switch {
    position: relative;
    width: 46px;
    height: 24px;
}

.toggle-switch input { display: none; }

.slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
}

.slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .slider {
    background: #22c55e;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(22px);
}


/* =========================================
   SAVE BUTTON
========================================= */

.save-btn {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: bold;
}


/* =========================================
   RESPONSIVE GRID
========================================= */

@media (max-width: 900px) {
    .analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


    .analytics-tabs .tab {
        font-size: 11px;
        padding: 5px 8px;
    }



/* =========================================
   EMAIL TEMPLATE PREVIEW SYSTEM
========================================= */

.template-wrapper {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.template-preview {
    width: 100%;
    max-width: 720px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
}

.template-header {
    padding: 12px 15px;
    background: #111827;
    color: #fff;
    display: flex;
    justify-content: space-between;
}

.template-content {
    background: #f9fafb;
}

.template-content-inner {
    background: #fff;
    padding: 10px;
    transform: scale(0.95);
    transform-origin: top center;
}

.template-actions {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #f3f4f6;
}

.template-actions button {
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-preview { background: #2563eb; color: #fff; }
.btn-refresh { background: #111827; color: #fff; }

.template-loading {
    text-align: center;
    padding: 20px;
}

.template-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #ddd;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}