/* Campaign Page Styles */

.campaign-page {
    min-height: 100vh;
    background-color: #f8fafc;
    width: 100%;
    overflow-x: hidden;
}

.campaigns-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Page Header */
.campaigns-page-header {
    margin-bottom: 32px;
}

.campaigns-page-title {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Filters Section */
.campaign-filters-section {
    margin-bottom: 24px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    position: relative;
    z-index: 50;
    overflow: visible;
}

.campaign-filters-row {
    display: flex;
    gap: 12px;
    padding: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.campaign-search-box,
.campaign-dropdown-filter {
    position: relative;
}

.campaign-search-box {
    flex: 1 1 280px;
    max-width: 400px;
    min-width: 220px;
}

.campaign-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
    z-index: 1;
}

.campaign-search-box input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 48px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    background: #fff;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    color: #1e293b;
}

.campaign-search-box input:focus {
    border-color: #000;
    outline: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
    transform: translateY(-1px);
}

.campaign-search-box input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Custom Select Dropdown */
.campaign-select {
    position: relative;
    min-width: 200px;
    flex: 0 1 auto;
}

.campaign-select-trigger {
    width: 100%;
    height: 48px;
    padding: 0 44px 0 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    white-space: nowrap;
}

.campaign-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #94a3b8;
    font-weight: 500;
}

.campaign-select-trigger:focus {
    outline: none;
}

/* Selected state visual indicator */
.campaign-select-trigger.has-selection {
    border-color: #000;
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.campaign-select-trigger.has-selection .campaign-select-label {
    color: #000;
    font-weight: 700;
}

/* Add check icon when selected */
.campaign-select-trigger.has-selection::before {
    content: '✓';
    position: absolute;
    left: 14px;
    font-size: 16px;
    color: #10b981;
    font-weight: 700;
    animation: checkmarkFadeIn 0.3s ease-out;
}

.campaign-select-trigger.has-selection .campaign-select-label {
    padding-left: 24px;
}

@keyframes checkmarkFadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.campaign-select.is-open .campaign-select-trigger {
    border-color: #000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .14);
    transform: translateY(-1px);
}

.campaign-select-caret {
    opacity: .85;
    transition: transform .2s;
}

.campaign-select.is-open .campaign-select-caret {
    transform: rotate(180deg);
}

.campaign-select-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .06);
    padding: 8px;
    z-index: 1000;
    display: none;
    transform-origin: top center;
    animation: selectIn .16s ease forwards;
    max-height: 280px;
    overflow: auto;
    backdrop-filter: saturate(1.2) blur(2px);
}

.campaign-select.is-open .campaign-select-panel {
    display: block;
}

@keyframes selectIn {
    from {
        opacity: 0;
        transform: scale(.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.campaign-select-panel button[role="option"] {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 10px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.campaign-select-panel button[role="option"]:hover {
    background: #f8fafc;
}

.campaign-select-panel button[role="option"].is-active {
    background: linear-gradient(135deg, #000, #374151);
    color: #fff;
}

.campaign-select-panel:focus {
    outline: none;
}

/* Clear Button */
.campaign-clear-btn {
    height: 46px;
    padding: 0 20px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    font-weight: 700;
    cursor: pointer;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.6;
    pointer-events: none;
}

.campaign-clear-btn.has-filters {
    opacity: 1;
    pointer-events: auto;
    border-color: #ef4444;
    color: #ef4444;
}

.campaign-clear-btn.has-filters::before {
    content: '×';
    font-size: 20px;
    font-weight: 700;
    animation: clearIconPulse 0.3s ease-out;
}

@keyframes clearIconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.campaign-clear-btn.has-filters:hover {
    border-color: #dc2626;
    background: #fef2f2;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, .2);
}

.campaign-clear-btn:not(.has-filters) {
    cursor: not-allowed;
}

/* Campaigns Table Section */
.campaigns-table-section {
    padding: 0;
}

.campaigns-table-wrapper {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.campaigns-table {
    width: 100%;
    border-collapse: collapse;
}

.campaigns-table thead {
    background-color: #f8fafc;
}

.campaigns-table thead th {
    padding: 16px 24px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
    letter-spacing: 0.5px;
}

.campaigns-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
}

.campaigns-table tbody tr:hover {
    background-color: #f8fafc;
}

.campaigns-table tbody tr:last-child {
    border-bottom: none;
}

.campaigns-table tbody td {
    padding: 20px 24px;
    vertical-align: middle;
}

/* Campaign Name Cell */
.campaign-name-cell {
    width: 25%;
}

.campaign-name-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.campaign-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 8px;
    background: white;
    flex-shrink: 0;
}

.campaign-logo-placeholder {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    flex-shrink: 0;
}

.campaign-logo-placeholder i {
    font-size: 32px;
}

.campaign-name {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
}

/* Discount Cell */
.campaign-discount-cell {
    width: 20%;
}

.discount-value {
    font-size: 14px;
    font-weight: 500;
    color: #ef4444;
    line-height: 1.5;
}

/* Description Cell */
.campaign-description-cell {
    width: 35%;
}

.campaign-detail-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
}

.campaign-description {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

.campaign-expired {
    display: inline-block;
    padding: 4px 8px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Dates Cell */
.campaign-dates-cell {
    width: 20%;
}

.campaign-dates-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.campaign-date {
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
}

/* No Campaigns */
.no-campaigns {
    text-align: center;
    padding: 80px 20px;
    grid-column: 1 / -1;
}

.no-campaigns i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.no-campaigns p {
    font-size: 18px;
    color: #999;
    margin: 0;
}

/* Responsive */
@media (max-width: 968px) {
    .campaigns-container {
        padding: 24px 16px;
    }

    .campaigns-page-title {
        font-size: 28px;
    }

    .campaign-filters-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .campaign-search-box {
        max-width: 100%;
        flex: 1 1 100%;
        min-width: auto;
    }

    .campaign-select {
        max-width: 100%;
        flex: 1 1 100%;
        min-width: auto;
    }

    .campaign-select-trigger {
        width: 100%;
    }

    .campaign-clear-btn {
        width: 100%;
        justify-content: center;
        margin-top: 4px;
    }

    /* Table responsive */
    .campaigns-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .campaign-logo,
    .campaign-logo-placeholder {
        width: 70px;
        height: 70px;
    }

    .campaign-logo-placeholder i {
        font-size: 28px;
    }
}

@media (max-width: 640px) {
    .campaigns-container {
        padding: 16px 12px;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Breadcrumb mobile */
    nav[aria-label="Breadcrumb"] {
        margin-bottom: 16px !important;
        overflow-x: hidden;
    }

    nav[aria-label="Breadcrumb"] ol {
        font-size: 13px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Page header mobile */
    .campaigns-page-header {
        margin-bottom: 20px;
    }

    .campaigns-page-title {
        font-size: 24px;
    }

    .campaign-filters-section {
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .campaign-filters-row {
        padding: 16px;
        gap: 10px;
    }

    .campaign-search-box input,
    .campaign-select-trigger {
        height: 44px;
        font-size: 14px;
    }

    .campaign-clear-btn {
        height: 42px;
        font-size: 13px;
    }

    /* Mobile table - card layout */
    .campaigns-table-section {
        padding: 0;
    }

    .campaigns-table-wrapper {
        overflow: visible;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .campaigns-table thead {
        display: none;
    }

    .campaigns-table,
    .campaigns-table tbody,
    .campaigns-table tr,
    .campaigns-table td {
        display: block;
        width: 100%;
    }

    .campaigns-table tbody tr {
        margin-bottom: 12px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        background: white;
    }

    .campaigns-table tbody tr:hover {
        background-color: white;
    }

    .campaigns-table tbody td {
        padding: 12px 14px;
        border-bottom: 1px solid #f1f5f9;
    }

    .campaigns-table tbody td:last-child {
        border-bottom: none;
    }

    .campaign-name-cell {
        width: 100%;
        padding: 14px 14px 12px 14px !important;
        background: #f8fafc;
        border-bottom: 2px solid #e2e8f0 !important;
    }

    .campaign-discount-cell,
    .campaign-description-cell,
    .campaign-dates-cell {
        width: 100%;
        position: relative;
        padding-top: 8px !important;
    }

    /* Add labels for mobile */
    .campaign-discount-cell::before,
    .campaign-description-cell::before,
    .campaign-dates-cell::before {
        content: attr(data-label);
        display: block;
        font-size: 10px;
        font-weight: 700;
        color: #64748b;
        text-transform: uppercase;
        margin-bottom: 6px;
        letter-spacing: 0.5px;
    }

    .campaign-name-wrapper {
        gap: 12px;
    }

    .campaign-logo,
    .campaign-logo-placeholder {
        width: 60px;
        height: 60px;
    }

    .campaign-logo-placeholder i {
        font-size: 24px;
    }

    .campaign-name {
        font-size: 14px;
    }

    .discount-value {
        font-size: 13px;
    }

    .campaign-description {
        font-size: 13px;
    }

    .campaign-date {
        font-size: 12px;
    }

    .campaign-detail-wrapper {
        gap: 8px;
    }

    .campaign-dates-wrapper {
        gap: 4px;
    }

    /* No campaigns mobile */
    .no-campaigns {
        padding: 60px 20px;
    }

    .no-campaigns i {
        font-size: 48px;
    }

    .no-campaigns p {
        font-size: 16px;
    }
}
