/**
 * Coverage Assistant Admin Styles
 * Modern card-based UI styling with toast notifications
 */

/* Layout Structure */
.stcwca-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    gap: 20px !important;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
}

/* Two-column layout - super specific selectors */
.wrap .stcwca-layout,
div.wrap div.stcwca-layout {
    display: flex !important;
    flex-direction: row !important;
    gap: 20px !important;
    align-items: flex-start !important;
    margin-top: 20px !important;
    flex-wrap: nowrap !important;
}

.wrap .stcwca-main-content,
div.wrap div.stcwca-main-content {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 340px) !important;
}

.wrap .stcwca-sidebar,
div.wrap div.stcwca-sidebar {
    width: 320px !important;
    flex: 0 0 320px !important;
    min-width: 320px !important;
}

/* Responsive breakpoint for smaller screens */
@media (max-width: 1024px) {
    .wrap .stcwca-layout,
    div.wrap div.stcwca-layout {
        flex-wrap: wrap !important;
    }
    
    .wrap .stcwca-main-content,
    div.wrap div.stcwca-main-content {
        max-width: 100% !important;
    }
    
    .wrap .stcwca-sidebar,
    div.wrap div.stcwca-sidebar {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
}

/* Card Styling */
.stcwca-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

/* Cards inside grid don't need bottom margin (grid gap handles it) */
.stcwca-grid .stcwca-card {
    margin-bottom: 0 !important;
}

/* Cards in main content and sidebar need bottom margin - FORCE IT */
.stcwca-main-content .stcwca-card,
.wrap .stcwca-main-content .stcwca-card,
div.wrap div.stcwca-main-content div.stcwca-card {
    margin-bottom: 20px !important;
}

.stcwca-sidebar .stcwca-card,
.wrap .stcwca-sidebar .stcwca-card,
div.wrap div.stcwca-sidebar div.stcwca-card {
    margin-bottom: 20px !important;
}

/* First child gets no top margin (for alignment) */
.stcwca-main-content .stcwca-card:first-child,
.wrap .stcwca-main-content .stcwca-card:first-child,
div.wrap div.stcwca-main-content div.stcwca-card:first-child {
    margin-top: 0 !important;
}

.stcwca-sidebar .stcwca-card:first-child,
.wrap .stcwca-sidebar .stcwca-card:first-child,
div.wrap div.stcwca-sidebar div.stcwca-card:first-child {
    margin-top: 0 !important;
}

/* Last child gets no bottom margin */
.stcwca-main-content .stcwca-card:last-child,
.wrap .stcwca-main-content .stcwca-card:last-child {
    margin-bottom: 0 !important;
}

.stcwca-sidebar .stcwca-card:last-child,
.wrap .stcwca-sidebar .stcwca-card:last-child {
    margin-bottom: 0 !important;
}

.stcwca-card h3,
.stcwca-panel-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    color: #23282d;
}

.stcwca-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    margin: 4px 0 6px;
    color: #1d2327;
}

.stcwca-value.stcwca-good {
    color: #46b450;
}

.stcwca-value.stcwca-warning {
    color: #f0b849;
}

.stcwca-value.stcwca-bad {
    color: #dc3232;
}

.stcwca-label {
    font-size: 13px;
    color: #646970;
}

.stcwca-panel {
    margin-top: 20px;
}

/* Type badges */
.stcwca-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.stcwca-type-post {
    background: #e3f2fd;
    color: #1976d2;
}

.stcwca-type-page {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Count badge */
.stcwca-count-badge {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

/* Table styling */
.widefat td,
.widefat th {
    vertical-align: middle;
}

/* Chart container */
#stcwca-trend-chart {
    width: 100%;
    height: auto;
}

/* Toast Notification Styles */
.stcwca-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #1d2327;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: bottom 0.3s ease-in-out;
    min-width: 250px;
    justify-content: center;
}

.stcwca-toast.stcwca-toast-show {
    bottom: 30px;
}

.stcwca-toast.stcwca-toast-success {
    border-left: 4px solid #46b450;
}

.stcwca-toast.stcwca-toast-error {
    border-left: 4px solid #dc3232;
}

.stcwca-toast .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.stcwca-toast-success .dashicons {
    color: #46b450;
}

.stcwca-toast-error .dashicons {
    color: #dc3232;
}

/* Copy Button States */
.copy-link-button {
    position: relative;
    transition: all 0.2s ease;
}

.copy-link-button:hover {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.copy-link-button.stcwca-copying {
    background: #f0f0f1;
    color: #646970;
    cursor: not-allowed;
}

.copy-link-button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
    margin-top: -2px;
}

/* Improve button spacing in table */
.widefat td .button {
    margin-right: 4px;
}

.widefat td .button:last-child {
    margin-right: 0;
}

/**
 * GUI Crawler Styles
 * @since 1.0.6
 */

/* Crawler Card */
.stcwca-crawler-card {
    margin-bottom: 20px;
}

/* Progress Bar */
.stcwca-progress-bar-wrapper {
    margin: 20px 0;
}

.stcwca-progress-bar {
    background: #f0f0f0;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid #ddd;
}

.stcwca-progress-fill {
    background: linear-gradient(90deg, #2271b1 0%, #135e96 100%);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

/* Stats Grid */
.stcwca-crawl-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Progress to Threshold Bar */
.stcwca-progress-to-threshold {
    margin-top: 20px;
}

/* Buttons */
#stcwca-start-crawl {
    font-size: 15px;
    height: auto;
    padding: 10px 20px;
}

#stcwca-stop-crawl {
    background: #dc3232;
    border-color: #dc3232;
    color: #fff;
}

#stcwca-stop-crawl:hover {
    background: #b32d2e;
    border-color: #b32d2e;
}

/* Sidebar button spacing */
.stcwca-sidebar .button {
    margin-bottom: 10px !important;
}

.stcwca-sidebar .button:last-of-type {
    margin-bottom: 0 !important;
}

/* Responsive adjustments */
@media (max-width: 782px) {
    .stcwca-crawl-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}
