/**
 * Royal Links Admin Styles
 */

/* Analytics Dashboard */
.royal-links-analytics-filters {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ccd0d4;
}

.royal-links-analytics-filters form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.royal-links-analytics-filters select {
    min-width: 150px;
}

.royal-links-stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.royal-links-stat-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    text-align: center;
}

.royal-links-stat-card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #666;
}

.royal-links-stat-card .stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #2271b1;
}

.royal-links-charts-row {
    margin-bottom: 30px;
}

.royal-links-chart-container {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
}

.royal-links-chart-container h3 {
    margin-top: 0;
}

.royal-links-chart-container canvas {
    max-height: 300px;
}

.royal-links-tables-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.royal-links-table-container {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
}

.royal-links-table-container h3 {
    margin-top: 0;
}

/* Import/Export */
.royal-links-import-export-wrapper {
    max-width: 800px;
}

.royal-links-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    margin-bottom: 20px;
}

.royal-links-section h2 {
    margin-top: 0;
}

.royal-links-migration-option {
    padding: 15px;
    background: #f6f7f7;
    margin-bottom: 10px;
}

.royal-links-migration-option h4 {
    margin: 0 0 5px;
}

.royal-links-migration-option p {
    margin: 0 0 10px;
    color: #666;
}

/* Links List Table */
.post-type-royal_link .wp-list-table {
    table-layout: auto;
}

.post-type-royal_link .wp-list-table th,
.post-type-royal_link .wp-list-table td {
    padding: 8px 10px;
    vertical-align: middle;
}

.post-type-royal_link .column-title {
    width: 20%;
}

.post-type-royal_link .column-short_link {
    width: 22%;
}

.post-type-royal_link .column-destination {
    width: 20%;
}

.post-type-royal_link .column-redirect_type {
    width: 10%;
}

.post-type-royal_link .column-clicks {
    width: 8%;
}

.post-type-royal_link .column-taxonomy-royal_link_category,
.post-type-royal_link .column-taxonomy-royal_link_tag {
    width: 8%;
    white-space: nowrap;
}

.post-type-royal_link .column-date {
    width: 12%;
}

/* Prevent column header text wrapping */
.post-type-royal_link .wp-list-table thead th {
    white-space: nowrap;
}

/* Short link code styling */
.post-type-royal_link .column-short_link code {
    font-size: 11px;
    background: #f0f0f1;
    padding: 2px 5px;
    word-break: break-all;
}

/* Destination URL truncation */
.post-type-royal_link .column-destination a {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.royal-links-copy {
    cursor: pointer;
}

.royal-links-copy.copied {
    background: #46b450 !important;
    border-color: #46b450 !important;
    color: #fff !important;
}

/* Quick Add Form */
.royal-links-quick-add {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    margin-bottom: 20px;
}

.royal-links-quick-add h3 {
    margin-top: 0;
}

.royal-links-quick-add .form-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.royal-links-quick-add .form-field {
    flex: 1;
}

.royal-links-quick-add label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.royal-links-quick-add input[type="text"],
.royal-links-quick-add input[type="url"] {
    width: 100%;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .royal-links-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .royal-links-tables-row {
        grid-template-columns: 1fr;
    }

    .royal-links-analytics-filters form {
        flex-wrap: wrap;
    }
}

@media screen and (max-width: 480px) {
    .royal-links-stats-cards {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   Dashboard Widget
   ========================================================================== */

#royal_links_dashboard_widget .inside {
    padding: 0 !important;
    margin: 0 !important;
}

.rl-dw-wrap {
    margin: 0;
}

.rl-dw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.rl-dw-header-period {
    font-weight: 600;
    font-size: 13px;
    color: #1e1e1e;
}

.rl-dw-header-timeframe {
    font-size: 12px;
    color: #6d6d6d;
}

.rl-dw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 15px;
}

.rl-dw-box {
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rl-dw-box:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.1);
}

.rl-dw-box-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #6d6d6d;
    margin-bottom: 8px;
}

.rl-dw-box-value {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.rl-dw-box-num {
    font-size: 24px;
    font-weight: 700;
    color: #1e1e1e;
    line-height: 1.2;
}

.rl-dw-change {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
}

.rl-dw-change.up {
    color: #2e7d32;
    background: #e8f5e9;
}

.rl-dw-change.down {
    color: #c62828;
    background: #ffebee;
}

.rl-dw-change.neutral {
    color: #6d6d6d;
    background: #f5f5f5;
}

.rl-dw-change .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}

.rl-dw-box-highlight {
    border-color: #dba617;
}

.rl-dw-box-highlight .rl-dw-box-num {
    color: #92400e;
}

.rl-dw-section {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
}

.rl-dw-section h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

.rl-dw-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
}

.rl-dw-row + .rl-dw-row {
    border-top: 1px solid #f0f0f1;
}

.rl-dw-row a {
    text-decoration: none;
}

.rl-dw-clicks-count {
    color: #646970;
    font-size: 12px;
    white-space: nowrap;
}

.rl-dw-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.rl-dw-badge-warning {
    background: #fcf0e3;
    color: #9a6700;
}

.rl-dw-empty {
    color: #646970;
    font-style: italic;
    font-size: 13px;
    padding: 4px 0;
}

.rl-dw-footer {
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rl-dw-footer a {
    font-size: 13px;
    text-decoration: none;
}

@media screen and (max-width: 782px) {
    .rl-dw-grid {
        grid-template-columns: 1fr;
    }

    .rl-dw-box-num {
        font-size: 20px;
    }
}

/* Settings Page Card */
.royal-links-settings-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 0 20px 20px;
    margin-top: 20px;
}

/* Settings Page Tabs */
.royal-links-settings-wrap .nav-tab-wrapper {
    margin-bottom: 20px;
}

.royal-links-settings-wrap .form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
}

.royal-links-settings-wrap .form-table td {
    padding: 15px 10px;
}

.royal-links-settings-wrap .form-table input[type="text"],
.royal-links-settings-wrap .form-table input[type="number"],
.royal-links-settings-wrap .form-table select {
    min-width: 200px;
}


/* ==========================================================================
   Meta Box: Link Settings
   ========================================================================== */

.royal-links-meta-table th {
    width: 150px;
}
.royal-links-slug-input {
    display: flex;
    align-items: center;
    gap: 5px;
}
.royal-links-slug-prefix {
    color: #666;
    font-family: monospace;
}
.royal-links-slug-input input {
    width: 200px;
}
.royal-links-slug-status {
    font-size: 12px;
}
.royal-links-slug-status.available {
    color: #46b450;
}
.royal-links-slug-status.taken {
    color: #dc3232;
}
.required {
    color: #dc3232;
}

/* ==========================================================================
   Meta Box: Link Options
   ========================================================================== */

.royal-links-options p {
    margin-bottom: 15px;
}
.royal-links-options .description {
    display: block;
    margin-left: 24px;
    font-size: 12px;
    color: #666;
}

/* ==========================================================================
   Meta Box: Link Statistics
   ========================================================================== */

.royal-links-stats .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.royal-links-stats .stat-row:last-of-type {
    border-bottom: none;
}
.royal-links-stats .stat-label {
    color: #666;
}
.royal-links-stats .stat-value {
    font-weight: bold;
}
.royal-links-stats .stat-value.broken {
    color: #dc3232;
}
.royal-links-stats .stat-value.healthy {
    color: #46b450;
}
.royal-links-stats p {
    margin-top: 15px;
}

/* ==========================================================================
   Meta Box: Short URL
   ========================================================================== */

.royal-links-short-url input {
    font-family: monospace;
    background: #f6f7f7;
}
.royal-links-short-url p {
    margin-top: 10px;
}
.royal-links-short-url .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    line-height: 1;
}

/* ==========================================================================
   Meta Box: Geo-Targeting
   ========================================================================== */

.royal-links-geo-rule-row {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.royal-links-geo-rule-row .select2-container {
    min-width: 300px;
}

/* ==========================================================================
   Meta Box: Split Testing
   ========================================================================== */

.royal-links-variant-row {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.variant-label {
    font-weight: bold;
    width: 80px;
}
.royal-links-winner-notice {
    background: #d6f4d6;
    color: #00662a;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.royal-links-winner-notice .dashicons {
    color: #00a32a;
}
.royal-links-winner-notice .button {
    margin-left: auto;
}

/* ==========================================================================
   Meta Box: Advanced Redirects
   ========================================================================== */

.royal-links-device-rule-row {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
}
.royal-links-limits-table th {
    width: 140px;
    padding: 10px 10px 10px 0;
    vertical-align: top;
}
.royal-links-limits-table td {
    padding: 10px 0;
}
.royal-links-limits-table .description {
    color: #666;
    font-size: 12px;
    margin-left: 5px;
}
.royal-links-click-status {
    display: inline-block;
    margin-top: 5px;
    font-size: 12px;
    color: #2271b1;
    font-weight: 500;
}
.royal-links-click-status.expired {
    color: #dc3232;
}
.royal-links-schedule-status {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}
.royal-links-schedule-status.active {
    background: #d6f4d6;
    color: #00662a;
}
.royal-links-schedule-status.scheduled {
    background: #fff3cd;
    color: #856404;
}
.royal-links-schedule-status.expired {
    background: #f8d7da;
    color: #721c24;
}
.royal-links-schedule-status .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Settings Page
   ========================================================================== */

.royal-links-submit-wrap {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}
.royal-links-settings-saved {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #00a32a;
    font-size: 14px;
}
.royal-links-settings-saved .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}
.royal-links-advanced-settings-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-top: 20px;
}
.royal-links-advanced-settings-section h2 {
    margin-top: 0;
    display: flex;
    align-items: center;
}
.royal-links-advanced-settings-section .form-table th {
    width: 200px;
}

/* ==========================================================================
   Link Health Page
   ========================================================================== */

.royal-links-health-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ccc;
}
.royal-links-health-stats {
    display: flex;
    gap: 30px;
}
.royal-links-health-stats .stat-item {
    display: flex;
    flex-direction: column;
}
.royal-links-health-stats .stat-label {
    font-size: 12px;
    color: #666;
}
.royal-links-health-stats .stat-value {
    font-size: 18px;
    font-weight: bold;
}
.royal-links-health-stats .stat-value.has-issues {
    color: #dc3232;
}
.royal-links-health-stats .stat-value.healthy {
    color: #46b450;
}
.royal-links-healthy-notice {
    text-align: center;
    padding: 40px;
    background: #fff;
    border: 1px solid #ccc;
}
.royal-links-healthy-notice .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #46b450;
}
.status-code {
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: bold;
}
.status-code.status-404 {
    background: #ffeaea;
    color: #dc3232;
}
.status-code.status-500,
.status-code.status-502,
.status-code.status-503 {
    background: #fff3e0;
    color: #ff9800;
}

/* ==========================================================================
   Split Testing Report Page
   ========================================================================== */

.royal-links-split-test-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}
.royal-links-split-test-card.test-ended {
    border-left: 4px solid #00a32a;
}
.royal-links-split-test-card.test-active {
    border-left: 4px solid #2271b1;
}
.royal-links-split-test-card .test-header {
    margin-bottom: 15px;
}
.royal-links-split-test-card h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.test-status-badge {
    font-size: 11px;
    font-weight: normal;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
}
.test-status-badge.active {
    background: #e7f5fe;
    color: #2271b1;
}
.test-status-badge.ended {
    background: #d6f4d6;
    color: #00a32a;
}
.winner-announcement {
    background: #d6f4d6;
    color: #00662a;
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.winner-announcement .dashicons {
    color: #00a32a;
}
.winner-reason {
    font-weight: normal;
    font-size: 12px;
    color: #666;
}
.winner-row {
    background: #f0fdf0 !important;
}
.winner-badge {
    color: #dba617;
    margin-left: 5px;
}
.winner-badge .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}
.progress-bar {
    display: inline-block;
    width: 100px;
    height: 20px;
    background: #eee;
    border-radius: 3px;
    margin-right: 10px;
    vertical-align: middle;
}
.progress-bar .progress {
    height: 100%;
    background: #2271b1;
    border-radius: 3px;
}
.progress-bar.winner .progress {
    background: #00a32a;
}
.stat-significant {
    color: #00a32a;
    font-size: 12px;
}
.stat-significant .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
}
.control-label, .variant-label {
    color: #757575;
    font-size: 12px;
}
.significance-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.significance-section h4 {
    margin: 0 0 10px;
    font-size: 13px;
}
.significance-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.significance-message.significant {
    background: #d6f4d6;
    color: #00662a;
}
.significance-message.not-significant {
    background: #f0f0f0;
    color: #555;
}
.significance-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.significance-stats .stat-item {
    font-size: 12px;
}
.significance-stats .stat-label {
    color: #757575;
    margin-right: 5px;
}
.significance-stats .stat-value {
    font-weight: 600;
}
.test-settings-summary {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.test-settings-summary h4 {
    margin: 0 0 10px;
    font-size: 13px;
}
.settings-grid {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}
.settings-grid .setting-item {
    font-size: 12px;
}
.settings-grid .setting-label {
    color: #757575;
    margin-right: 5px;
}
.settings-grid .setting-value {
    font-weight: 500;
}

/* ==========================================
   Founders Bundle Banner — hero with 6-card grid
   ========================================== */

.royal-links-founders-banner {
    position: relative;
    background: linear-gradient(135deg, #14102e 0%, #241a52 50%, #3a1f6b 100%);
    border-radius: 12px;
    padding: 32px 36px;
    margin: 32px 0 24px 0;
    overflow: hidden;
    color: #fff;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 36px;
    align-items: center;
    box-shadow: 0 8px 24px rgba(20, 16, 46, 0.18);
    box-sizing: border-box;
}

.royal-links-founders-banner::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -8%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(201, 162, 39, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.royal-links-founders-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 50%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(107, 45, 184, 0.18) 0%, transparent 60%);
    pointer-events: none;
}

.royal-links-founders-left {
    position: relative;
    z-index: 1;
}

.royal-links-founders-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f0c83a;
    margin-bottom: 12px;
    padding: 4px 10px;
    background: rgba(240, 200, 58, 0.1);
    border: 1px solid rgba(240, 200, 58, 0.25);
    border-radius: 100px;
}

.royal-links-founders-eyebrow .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    line-height: 1;
}

.royal-links-founders-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 10px 0;
    color: #fff;
    letter-spacing: -0.01em;
}

.royal-links-founders-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.55;
    margin: 0 0 20px 0;
    max-width: 440px;
}

.royal-links-founders-banner .royal-links-founders-cta-primary {
    background: linear-gradient(135deg, #f0c83a, #d4a517);
    color: #1a1438;
    border: 0;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(212, 165, 23, 0.3);
}

.royal-links-founders-banner .royal-links-founders-cta-primary:hover,
.royal-links-founders-banner .royal-links-founders-cta-primary:focus {
    transform: translateY(-1px);
    color: #1a1438;
    box-shadow: 0 6px 16px rgba(212, 165, 23, 0.45);
}

.royal-links-founders-banner .royal-links-founders-cta-primary .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.royal-links-founders-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    position: relative;
    z-index: 1;
}

.royal-links-founders-grid-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 12.5px;
    font-weight: 500;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    text-decoration: none;
}

.royal-links-founders-grid-item:hover,
.royal-links-founders-grid-item:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(240, 200, 58, 0.35);
    transform: translateY(-2px);
    color: #fff;
}

.royal-links-founders-grid-item .dashicons {
    color: #f0c83a;
    font-size: 26px;
    width: 26px;
    height: 26px;
    line-height: 1;
}

.royal-links-founders-grid-item-name {
    line-height: 1.3;
}

.royal-links-founders-dismiss {
    position: absolute;
    top: 12px;
    right: 14px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    padding: 6px;
    line-height: 1;
    border-radius: 4px;
    z-index: 2;
    display: inline-flex;
    transition: color 0.15s ease, background 0.15s ease;
}

.royal-links-founders-dismiss:hover,
.royal-links-founders-dismiss:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.royal-links-founders-dismiss .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

@media (max-width: 900px) {
    .royal-links-founders-banner {
        grid-template-columns: 1fr;
        padding: 24px;
    }
    .royal-links-founders-subtitle {
        max-width: none;
    }
}

@media (max-width: 600px) {
    .royal-links-founders-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .royal-links-founders-title {
        font-size: 20px;
    }
}
