@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/**
 * AD View Count — Enterprise Filter Card Dashboard Styles
 * Highly professional, standard layout pattern with integrated navigation tabs,
 * clean structured form controls, predictable label placement, and robust table views.
 * Fully optimized with responsive CSS Grid reflows for desktop, tablet, and mobile viewports.
 */

:root {
    --advc-primary: #ae0000;
    --advc-primary-alpha: rgba(174, 0, 0, 0.1);
    --advc-text-main: #0f172a;
    --advc-text-muted: #64748b;
    --advc-border: #e2e8f0;
    --advc-card-bg: #ffffff;
    --advc-transition: all 0.2s ease-in-out;
}

/* =========================================================
   WRAPPER & HEADERS
   ========================================================= */
.advc-stats-wrapper {
    width: 100%;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--advc-text-main);
    line-height: 1.5;
    box-sizing: border-box;
    padding: 8px 0;
}

.advc-stats-wrapper *,
.advc-stats-wrapper *::before,
.advc-stats-wrapper *::after {
    box-sizing: inherit;
}

.advc-dashboard-header {
    margin-bottom: 24px;
}

.advc-header-titles .advc-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0 0 4px 0;
    color: var(--advc-text-main);
    line-height: 1.2;
}

.advc-header-titles .advc-subtitle {
    font-size: 14px;
    color: var(--advc-text-muted);
    margin: 0;
}

/* =========================================================
   SUMMARY CARDS
   ========================================================= */
.advc-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.advc-summary-card {
    background: var(--advc-card-bg);
    border: 1px solid var(--advc-border);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    transition: var(--advc-transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.advc-summary-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--advc-border);
    transition: var(--advc-transition);
}

.advc-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.advc-summary-card:hover::after {
    background: var(--advc-primary);
}

.advc-summary-total::after { background: var(--advc-primary); }
.advc-summary-nekretnina:hover::after { background: #0ea5e9; }
.advc-summary-dogadjaji:hover::after { background: #f59e0b; }
.advc-summary-biznis:hover::after { background: #10b981; }

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

.advc-card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--advc-text-muted);
}

.advc-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.advc-card-icon svg {
    width: 18px;
    height: 18px;
}

.advc-summary-total .advc-card-icon { background: var(--advc-primary-alpha); color: var(--advc-primary); }
.advc-summary-nekretnina .advc-card-icon { background: rgba(14, 165, 233, 0.1); color: #0ea5e9; }
.advc-summary-dogadjaji .advc-card-icon { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.advc-summary-biznis .advc-card-icon { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.advc-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.advc-card-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--advc-text-main);
    font-feature-settings: "tnum";
}

.advc-card-sub {
    font-size: 12px;
    color: var(--advc-text-muted);
}

.advc-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--advc-primary);
    margin-top: 2px;
}

/* =========================================================
   ADVANCED FILTER PANEL CARD
   ========================================================= */
.advc-filters-card {
    background: #ffffff;
    border: 1px solid var(--advc-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    overflow: hidden;
}

/* Controls Tier: Advanced Responsive Grid Layout */
.advc-filters-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: end;
}

/* Navigation Tabs embedded inside Grid */
.advc-tabs-group {
    grid-column: 1 / -1; /* Span full width of the grid row */
    margin-bottom: 4px;
}

.advc-tabs-nav {
    display: flex;
    flex-wrap: wrap; /* CRITICAL: Enables tabs to wrap cleanly into rows on smaller viewports */
    gap: 8px;
    width: 100%;
}

button.advc-tab.advc-nav-tab {
    background: transparent;
    color: var(--e-global-color-primary, var(--advc-primary));
    border: 1px solid var(--e-global-color-primary, var(--advc-primary));
    border-radius: 8px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--advc-transition);
    white-space: nowrap;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    box-sizing: border-box;
}

button.advc-tab.advc-nav-tab:hover {
    background: rgba(174, 0, 0, 0.04);
}

button.advc-tab.advc-nav-tab.active {
    background: var(--e-global-color-primary, var(--advc-primary));
    color: #ffffff;
    border-color: var(--e-global-color-primary, var(--advc-primary));
}

.advc-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.advc-actions-group {
    justify-self: stretch;
}

.advc-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    display: block;
}

/* Spacer label behavior: Keep visible but transparent to maintain perfect button baseline alignments */
.advc-spacer-label {
    opacity: 0;
    pointer-events: none;
    user-select: none;
}

/* Form Controls */
.advc-form-control {
    height: 38px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--advc-text-main);
    background-color: #ffffff;
    transition: var(--advc-transition);
    outline: none;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.advc-form-control:focus {
    border-color: var(--advc-primary);
    box-shadow: 0 0 0 3px var(--advc-primary-alpha);
}

select.advc-form-control {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%2364748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* Premium Modern Date Input Styling */
input[type="date"].advc-form-control {
    color: var(--advc-text-main);
    font-size: 13px;
    font-weight: 500;
    padding: 0 12px 0 40px; /* Space for icon on the left */
    cursor: pointer;
    background-color: #ffffff;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23ae0000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>');
    background-repeat: no-repeat;
    background-position: left 14px center;
    position: relative;
}

input[type="date"].advc-form-control:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

/* Hide native icon but make it cover the entire input so clicking anywhere opens the picker */
input[type="date"].advc-form-control::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

/* Solid Buttons */
.advc-btn-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.advc-btn-solid {
    height: 38px;
    padding: 0 16px;
    border-radius: 8px !important;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--advc-transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex: 1;
}

.advc-btn-primary {
    background: var(--advc-primary);
    color: #ffffff;
}

.advc-btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.advc-btn-primary:active {
    transform: translateY(0);
}

.advc-btn-light {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.advc-btn-light:hover {
    background: #e2e8f0;
    color: var(--advc-text-main);
}

/* =========================================================
   DATA TABLE CONTAINER
   ========================================================= */
.advc-table-container {
    background: #ffffff;
    border: 1px solid var(--advc-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.advc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

/* Headers */
.advc-table thead th {
    background: #f8fafc;
    padding: 14px 18px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    border-bottom: 1px solid var(--advc-border);
    transition: background 0.2s;
    white-space: nowrap;
}

.advc-table thead th:first-child {
    border-top-left-radius: 12px;
}

.advc-table thead th:last-child {
    border-top-right-radius: 12px;
}

.advc-sortable {
    cursor: pointer;
    user-select: none;
}

.advc-sortable:hover {
    background: #f1f5f9;
    color: var(--advc-text-main);
}

.advc-sort-icon {
    display: inline-block;
    font-size: 10px;
    color: var(--advc-primary);
    margin-left: 4px;
}

.advc-sorted-asc,
.advc-sorted-desc {
    color: var(--advc-primary);
    font-weight: 700;
}

/* Alignments */
.advc-th-num,
.advc-td-num {
    width: 48px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.advc-th-views,
.advc-td-views {
    text-align: right;
    width: 130px;
}

.advc-th-date {
    width: 130px;
}

.advc-th-type {
    width: 140px;
}

/* Body */
.advc-table tbody td {
    padding: 14px 18px;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
    vertical-align: middle;
}

.advc-row:hover td {
    background: #f8fafc;
}

.advc-row:last-child td {
    border-bottom: none;
}

/* Links */
.advc-td-title a {
    color: var(--advc-text-main);
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    transition: color 0.2s;
}

.advc-td-title a:hover {
    color: var(--advc-primary);
    text-decoration: underline;
}

/* Standardized Flat Badges */
.advc-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

.advc-type-nekretnina {
    background: #e0f2fe;
    color: #0369a1;
}

.advc-type-dogadjaji {
    background: #fef3c7;
    color: #b45309;
}

.advc-type-biznis {
    background: #d1fae5;
    color: #047857;
}

/* View Count Column */
.advc-td-views {
    font-weight: 600;
    color: var(--advc-text-main);
    font-feature-settings: "tnum";
}

.advc-td-date {
    color: var(--advc-text-muted);
    font-size: 13px;
}

/* Empty State */
.advc-empty-row td {
    text-align: center;
    padding: 48px 20px;
    color: var(--advc-text-muted);
    font-size: 14px;
}

/* =========================================================
   PAGINATION
   ========================================================= */
.advc-pagination {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.advc-pagination-buttons {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.advc-page-btn {
    height: 34px;
    min-width: 34px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--advc-border);
    background: #ffffff;
    color: #475569;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--advc-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.advc-page-btn:hover:not(.disabled):not(.active) {
    background: #f1f5f9;
    color: var(--advc-text-main);
    border-color: #cbd5e1;
}

.advc-page-btn.active {
    background: var(--advc-primary);
    border-color: var(--advc-primary);
    color: #ffffff;
    font-weight: 600;
}

.advc-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8fafc;
}

.advc-page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    color: #94a3b8;
    font-weight: 500;
}

.advc-page-info {
    font-size: 13px;
    color: var(--advc-text-muted);
    text-align: center;
}

/* =========================================================
   INTELLIGENT RESPONSIVE REFLOWS
   ========================================================= */

/* Large viewports & intermediate screens: Switch to a balanced 2-column layout */
@media (max-width: 1100px) {
    .advc-filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* Tablet viewports */
@media (max-width: 768px) {
    .advc-dashboard-header {
        margin-bottom: 16px;
    }

    .advc-header-titles .advc-title {
        font-size: 20px;
    }

    button.advc-tab.advc-nav-tab {
        padding: 0 14px;
        font-size: 12px;
    }

    .advc-filters-grid {
        padding: 16px;
        gap: 14px;
    }

    .advc-table thead th {
        padding: 12px 10px;
    }

    .advc-table tbody td {
        padding: 12px 10px;
        font-size: 13px;
    }

    .advc-th-num,
    .advc-td-num {
        width: 36px;
    }

    .advc-th-views,
    .advc-td-views {
        width: 80px;
    }

    .advc-th-type {
        width: 100px;
    }

    .advc-td-title a {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
    }
}

/* Small screens / Mobile viewports: Perfect multi-row modular layout */
@media (max-width: 576px) {
    /* Show 2 stats cards per line on mobile perfectly scaled */
    .advc-summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .advc-summary-card {
        padding: 12px 14px;
        border-radius: 10px;
    }

    .advc-card-header {
        margin-bottom: 8px;
    }

    .advc-card-label {
        font-size: 10px;
        letter-spacing: 0.2px;
    }

    .advc-card-icon {
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }

    .advc-card-icon svg {
        width: 14px;
        height: 14px;
    }

    .advc-card-value {
        font-size: 20px;
    }

    .advc-card-sub {
        font-size: 10px;
    }

    .advc-card-trend {
        font-size: 10px;
        gap: 2px;
    }

    .advc-card-trend svg {
        width: 12px;
        height: 12px;
    }

    /* Reflow filter grid for mobile viewports */
    .advc-filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 14px;
    }

    /* Let Select dropdown and Actions span full width on their own rows */
    .advc-select-group,
    .advc-actions-group {
        grid-column: 1 / -1;
    }

    /* Remove invisible spacer label on mobile since actions row sits alone */
    .advc-spacer-label {
        display: none !important;
    }

    .advc-btn-solid,
    .advc-form-control {
        height: 42px; /* Touch optimized sizing */
    }

    /* Compact Table view widths to eliminate horizontal scrolling completely */
    .advc-table thead th,
    .advc-table tbody td {
        padding: 10px 8px;
    }

    .advc-th-num,
    .advc-td-num {
        width: 28px;
        font-size: 12px;
    }

    .advc-th-views,
    .advc-td-views {
        width: 65px;
        font-size: 13px;
    }

    .advc-th-type {
        width: 85px;
    }

    .advc-type-badge {
        padding: 2px 6px;
        font-size: 11px;
    }

    /* Hide less critical columns to preserve clear title/views legibility */
    .advc-th-date,
    .advc-td-date {
        display: none;
    }
}
