/**
 * LMIn Manage Link Page Styles
 * Matches my-links color scheme with #3B82F6 accent
 * Uses Greenshift fluid typography variables from lmin-links.css
 */

/* ============================================
   PAGE LAYOUT
   ============================================ */

.lmin-manage-link-wrap {
    max-width: 1600px;
    margin: 0 auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--lmin-slate-800, #1E293B);
}

/* ============================================
   LINK TITLE (above header)
   ============================================ */

.lmin-ml-title-section {
    margin-bottom: var(--space-3, 16px);
}

.lmin-ml-title {
    font-size: 28px;
    font-weight: 900;
    color: var(--lmin-slate-900, #0F172A);
    margin: 0;
    line-height: 1.2;
}

/* ============================================
   HEADER
   ============================================ */

.lmin-ml-header {
    margin-bottom: var(--space-6, 32px);
}

.lmin-ml-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4, 16px);
}

/* Larger, more prominent Edit button */
.lmin-ml-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: var(--lmin-size-2xs, 14px);
    font-weight: 600;
    color: white;
    background: var(--lmin-accent, #3B82F6);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lmin-ml-edit-btn:hover {
    background: var(--lmin-accent-dark, #2563EB);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.lmin-ml-edit-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================
   EDIT MODAL FORM STYLES
   ============================================ */

.lmin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.lmin-form-left,
.lmin-form-right {
    display: flex;
    flex-direction: column;
}

.lmin-form-group {
    margin-bottom: 16px;
}

.lmin-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--lmin-slate-700, #334155);
}

.lmin-form-group input[type="text"],
.lmin-form-group input[type="url"],
.lmin-form-group input[type="password"],
.lmin-form-group input[type="number"],
.lmin-form-group input[type="datetime-local"],
.lmin-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--lmin-slate-200, #E2E8F0);
    border-radius: 6px;
    font-size: var(--lmin-size-2xs, 14px);
    color: var(--lmin-slate-800, #1E293B);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lmin-form-group input:focus,
.lmin-form-group select:focus {
    outline: none;
    border-color: var(--lmin-accent, #3B82F6);
    box-shadow: 0 0 0 3px var(--lmin-accent-bg, #EFF6FF);
}

.lmin-form-checkbox {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.lmin-form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.lmin-form-checkbox label {
    margin-bottom: 0;
    cursor: pointer;
}

.lmin-form-hint {
    display: block;
    font-size: var(--lmin-size-3xs, 12px);
    color: var(--lmin-slate-500, #64748B);
    margin-top: 4px;
}

@media (max-width: 768px) {
    .lmin-form-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   TIMESPAN SELECTOR
   ============================================ */

.lmin-ml-timespan {
    margin-bottom: 0;
}

.lmin-ml-select {
    padding: var(--space-2, 8px) var(--space-3, 12px);
    border: 1px solid var(--lmin-slate-200, #E2E8F0);
    border-radius: 6px;
    background: white;
    color: var(--lmin-slate-700, #334155);
    font-size: var(--lmin-size-2xs);
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lmin-ml-select:hover {
    border-color: var(--lmin-accent-light, #60A5FA);
}

.lmin-ml-select:focus {
    outline: none;
    border-color: var(--lmin-accent, #3B82F6);
    box-shadow: 0 0 0 3px var(--lmin-accent-bg, #EFF6FF);
}

/* ============================================
   BENTO GRID LAYOUT - All Direct Children
   ============================================ */

/* Main bento container - 3 columns
   Row 1: 3 metric cards (1 col each)
   Row 2: Chart (2 cols) + Info (1 col)
*/
.lmin-ml-bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 1fr;
    gap: 1.5rem;
    margin-bottom: var(--space-6, 32px);
}

/* Metric cards - row 1, one column each */
.lmin-ml-metric-card {
    display: flex;
    align-items: center;
    gap: var(--space-4, 16px);
    padding: var(--space-5, 24px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.lmin-ml-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Metric card icon */
.lmin-ml-metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

.lmin-ml-metric-icon svg {
    width: 24px;
    height: 24px;
}

.lmin-ml-icon-clicks {
    background: var(--lmin-accent-bg, #EFF6FF);
    color: var(--lmin-accent, #3B82F6);
}

.lmin-ml-icon-visitors {
    background: #DCFCE7;
    color: #22C55E;
}

.lmin-ml-icon-device {
    background: #FEF3C7;
    color: #B45309;
}

/* Metric content */
.lmin-ml-metric-content {
    display: flex;
    flex-direction: column;
}

.lmin-ml-metric-value {
    font-size: var(--lmin-size-m);
    font-weight: 900;
    color: var(--lmin-slate-900, #0F172A);
    line-height: 1.2;
}

.lmin-ml-metric-label {
    font-size: var(--lmin-size-2xs);
    font-weight: 700;
    color: var(--lmin-slate-500, #64748B);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* Chart card - row 2, spans 2 columns */
.lmin-ml-chart-card {
    grid-column: 1 / 3;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

/* Info card - row 2, spans 1 column */
.lmin-ml-info-card {
    grid-column: 3;
}

/* Card styling */
.lmin-ml-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: var(--space-5, 24px);
    height: 100%;
}

.lmin-ml-card-title {
    font-size: var(--lmin-size-s);
    font-weight: 800;
    color: var(--lmin-slate-800, #1E293B);
    margin: 0 0 var(--space-4, 16px) 0;
    flex-shrink: 0;
}

/* Chart container fills remaining space */
.lmin-ml-chart-container {
    position: relative;
    flex: 1;
    min-height: 0;
}

.lmin-ml-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Info Card */
.lmin-ml-info-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 16px);
}

.lmin-ml-info-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-3, 12px);
    border-radius: 8px;
    transition: background 0.2s;
}

.lmin-ml-info-row:hover {
    background: var(--lmin-slate-50, #F8FAFC);
}

.lmin-ml-info-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--lmin-size-3xs);
    font-weight: 700;
    color: var(--lmin-slate-400, #94A3B8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lmin-ml-info-label svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.lmin-ml-info-value {
    font-size: var(--lmin-size-2xs);
    font-weight: 500;
    color: var(--lmin-slate-800, #1E293B);
    word-break: break-all;
}

.lmin-ml-info-url {
    font-size: var(--lmin-size-2xs);
    font-weight: 500;
    color: white;
    text-decoration: none;
    word-break: break-all;
    padding: 4px 8px;
    background: var(--lmin-accent, #3B82F6);
    border-radius: 4px;
    display: inline-block;
}

.lmin-ml-info-url:hover {
    text-decoration: underline;
    background: var(--lmin-accent-dark, #2563EB);
}

/* Status badge styling */
.lmin-ml-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: var(--lmin-size-3xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.lmin-ml-status-badge.active,
.lmin-ml-status-badge.published,
.lmin-ml-status-badge.published-2 {
    background: #DCFCE7;
    color: #166534;
}

.lmin-ml-status-badge.draft,
.lmin-ml-status-badge.draft-1 {
    background: #FEF3C7;
    color: #92400E;
}

.lmin-ml-status-badge.trashed,
.lmin-ml-status-badge.trashed-0 {
    background: #FEE2E2;
    color: #991B1B;
}

/* Colored SVG icons for info rows */
.lmin-ml-info-short-url svg {
    color: var(--lmin-accent, #3B82F6);
}

.lmin-ml-info-target-url svg {
    color: #8B5CF6;
}

.lmin-ml-info-status svg {
    color: #22C55E;
}

.lmin-ml-info-created svg {
    color: #F59E0B;
}

.lmin-ml-info-tags svg {
    color: #EC4899;
}

/* ============================================
   VISITS TABLE
   ============================================ */

.lmin-ml-visits-card {
    margin-bottom: var(--space-6, 32px);
}

.lmin-ml-visits-table-wrap {
    overflow-x: auto;
}

.lmin-ml-visits-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--lmin-size-2xs);
}

.lmin-ml-visits-table th {
    text-align: left;
    padding: var(--space-3, 12px);
    font-weight: 600;
    color: var(--lmin-slate-600, #475569);
    border-bottom: 1px solid var(--lmin-slate-200, #E2E8F0);
    white-space: nowrap;
}

.lmin-ml-visits-table td {
    padding: var(--space-3, 12px);
    color: var(--lmin-slate-700, #334155);
    border-bottom: 1px solid var(--lmin-slate-100, #F1F5F9);
}

.lmin-ml-visits-table tr:hover td {
    background: var(--lmin-slate-50, #F8FAFC);
}

.lmin-ml-loading-row td {
    text-align: center;
    padding: var(--space-8, 32px);
    color: var(--lmin-slate-500, #64748B);
}

.lmin-ml-loading {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2, 8px);
}

/* ============================================
   NOTICES
   ============================================ */

.lmin-ml-notices {
    margin-top: var(--space-4, 16px);
}

.lmin-ml-notice {
    padding: var(--space-4, 16px);
    background: var(--lmin-accent-bg, #EFF6FF);
    border: 1px solid var(--lmin-accent-border, #BFDBFE);
    border-radius: 8px;
    color: var(--lmin-accent-dark, #1D4ED8);
}

.lmin-ml-notice p {
    margin: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .lmin-ml-header-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .lmin-ml-bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .lmin-ml-chart-card {
        grid-column: 1 / 3;
    }
    
    .lmin-ml-info-card {
        grid-column: 1 / 3;
    }
}

@media (max-width: 768px) {
    .lmin-ml-bento-grid {
        grid-template-columns: 1fr;
    }
    
    .lmin-ml-metric-card {
        grid-column: 1 !important;
    }
    
    .lmin-ml-chart-card {
        grid-column: 1 !important;
    }
    
    .lmin-ml-info-card {
        grid-column: 1 !important;
    }
}

@media (max-width: 640px) {
    .lmin-ml-bento-grid {
        grid-template-columns: 1fr;
    }
    
    .lmin-ml-metric-card {
        grid-column: 1 !important;
    }
    
    .lmin-ml-chart-card {
        grid-column: 1 !important;
        min-height: 300px;
    }
    
    .lmin-ml-info-card {
        grid-column: 1 !important;
    }
    
    .lmin-ml-metric-card {
        padding: var(--space-4, 16px);
    }
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.lmin-ml-skeleton {
    background: linear-gradient(90deg, #e2e8f0, #f1f5f9, #e2e8f0);
    background-size: 200% 100%;
    animation: lmin-ml-skeleton-shimmer 1.5s infinite;
    border-radius: var(--lmin-radius-md);
}

@keyframes lmin-ml-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Title skeleton */
.lmin-ml-title-skeleton {
    height: 34px;
    width: 200px;
    margin-bottom: var(--space-3, 16px);
}

/* Header row skeleton */
.lmin-ml-header-row-skeleton {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 42px;
}

.lmin-ml-edit-btn-skeleton {
    height: 42px;
    width: 110px;
}

.lmin-ml-select-skeleton {
    height: 42px;
    width: 140px;
}

/* Metric card skeleton */
.lmin-ml-metric-card-skeleton {
    padding: var(--space-4, 16px);
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
}

.lmin-ml-metric-icon-skeleton {
    width: 48px;
    height: 48px;
    border-radius: var(--lmin-radius-lg);
}

.lmin-ml-metric-value-skeleton {
    height: 28px;
    width: 80px;
}

.lmin-ml-metric-label-skeleton {
    height: 14px;
    width: 100px;
}

/* Chart skeleton */
.lmin-ml-chart-skeleton {
    height: 250px;
    width: 100%;
}

/* Info card skeleton */
.lmin-ml-info-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 12px);
    padding: var(--space-2, 8px);
}

.lmin-ml-info-row-skeleton {
    height: 20px;
    width: 100%;
}

.lmin-ml-info-row-skeleton:nth-child(2) { width: 85%; }
.lmin-ml-info-row-skeleton:nth-child(3) { width: 70%; }
.lmin-ml-info-row-skeleton:nth-child(4) { width: 90%; }
.lmin-ml-info-row-skeleton:nth-child(5) { width: 60%; }
.lmin-ml-info-row-skeleton:nth-child(6) { width: 75%; }

/* Visits table skeleton */
.lmin-ml-visits-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
}

.lmin-ml-visits-row-skeleton {
    height: 36px;
    width: 100%;
}

.lmin-ml-visits-row-skeleton:nth-child(1) { width: 90%; }
.lmin-ml-visits-row-skeleton:nth-child(2) { width: 85%; }
.lmin-ml-visits-row-skeleton:nth-child(3) { width: 95%; }
.lmin-ml-visits-row-skeleton:nth-child(4) { width: 70%; }
.lmin-ml-visits-row-skeleton:nth-child(5) { width: 80%; }

/* Hide skeleton when loaded */
.lmin-ml-skeleton.lmin-ml-loaded {
    display: none;
}