/**
 * Ariadna Learning Paths - Styles v4.10
 * Shortcode-based design - UI/UX Improvements
 */

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

:root {
    /* Primary colors */
    --alp-primary: #2563eb;
    --alp-primary-hover: #1d4ed8;
    --alp-primary-light: #dbeafe;
    --alp-primary-dark: #1e40af;
    
    /* Neutral colors */
    --alp-text: #0f172a;
    --alp-text-secondary: #334155;
    --alp-muted: #64748b;
    --alp-border: #e2e8f0;
    --alp-border-light: #f1f5f9;
    --alp-bg: #f8fafc;
    --alp-bg-elevated: #ffffff;
    --alp-white: #ffffff;
    
    /* Status colors - semantic */
    --alp-danger: #dc2626;
    --alp-danger-light: #fef2f2;
    --alp-danger-border: #fecaca;
    --alp-success: #16a34a;
    --alp-success-light: #dcfce7;
    --alp-success-border: #bbf7d0;
    --alp-warning: #d97706;
    --alp-warning-light: #fef3c7;
    --alp-warning-border: #fde68a;
    --alp-info: #0284c7;
    --alp-info-light: #e0f2fe;
    
    /* Spacing system - 4px base */
    --alp-space-1: 4px;
    --alp-space-2: 8px;
    --alp-space-3: 12px;
    --alp-space-4: 16px;
    --alp-space-5: 20px;
    --alp-space-6: 24px;
    --alp-space-8: 32px;
    --alp-space-10: 40px;
    
    /* Border radius */
    --alp-radius: 12px;
    --alp-radius-sm: 8px;
    --alp-radius-lg: 16px;
    --alp-radius-xl: 20px;
    --alp-radius-full: 9999px;
    
    /* Shadows */
    --alp-shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --alp-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --alp-shadow-md: 0 6px 12px -2px rgba(0,0,0,0.08), 0 3px 6px -3px rgba(0,0,0,0.06);
    --alp-shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);
    --alp-shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.15);
    
    /* Typography */
    --alp-font-size-xs: 11px;
    --alp-font-size-sm: 13px;
    --alp-font-size-base: 15px;
    --alp-font-size-lg: 17px;
    --alp-font-size-xl: 20px;
    --alp-font-size-2xl: 24px;
    --alp-font-size-3xl: 28px;
    
    /* Transitions */
    --alp-transition-fast: 0.15s ease;
    --alp-transition: 0.2s ease;
    --alp-transition-slow: 0.3s ease;
}

/* ===== Shortcode Wrappers ===== */
.alp-archive-wrapper,
.alp-editor-wrapper,
.alp-single-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 0;
}

.alp-archive-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.alp-editor-header,
.alp-single-header {
    margin-bottom: 24px;
}

.alp-editor-header h2,
.alp-single-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--alp-text);
    margin: 8px 0;
    letter-spacing: -0.5px;
}

/* Notice boxes */
.alp-login-notice,
.alp-error-notice {
    background: var(--alp-white);
    border: 1px solid var(--alp-border);
    border-radius: var(--alp-radius);
    padding: 32px;
    text-align: center;
}

.alp-login-notice p,
.alp-error-notice p {
    margin: 0 0 16px 0;
    color: var(--alp-muted);
}

.alp-error-notice {
    border-color: #fca5a5;
    background: #fef2f2;
}

.alp-error-notice p {
    color: var(--alp-danger);
}

/* ===== Base Typography (full page templates) ===== */
.alp-editor-page,
.alp-single-page,
.alp-archive-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--alp-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Layout ===== */
.alp-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ===== Header ===== */
.alp-header {
    margin-bottom: 32px;
}

.alp-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--alp-text);
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
}

.alp-header p {
    color: var(--alp-muted);
    margin: 0;
    font-size: 15px;
}

.alp-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--alp-muted);
    text-decoration: none;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s;
}
.alp-back:hover {
    color: var(--alp-primary);
}

.alp-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.alp-title-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alp-description {
    color: var(--alp-muted);
    line-height: 1.6;
    margin: 16px 0;
    font-size: 15px;
}
.alp-description p {
    margin: 0;
}

.alp-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--alp-muted);
}

/* ===== Buttons ===== */
.alp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 24px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    font-family: inherit;
}

.alp-btn-primary {
    background: linear-gradient(135deg, #255afd 0%, #1e4ad4 100%);
    color: white;
}
.alp-btn-primary:hover {
    background: linear-gradient(135deg, #1e4ad4 0%, #1a3fb8 100%);
    transform: translateY(-1px);
    color: white;
}

.alp-btn-secondary {
    background: var(--alp-white);
    color: var(--alp-muted);
    border: 2px solid var(--alp-border);
}
.alp-btn-secondary:hover {
    border-color: #cbd5e1;
    color: #475569;
    background: var(--alp-bg);
}

.alp-btn-danger {
    background: var(--alp-white);
    color: var(--alp-danger);
    border: 2px solid #fca5a5;
}
.alp-btn-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.alp-btn-small {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.alp-btn-add {
    display: block;
    width: 100%;
    padding: 18px;
    background: var(--alp-white);
    border: 2px dashed var(--alp-border);
    border-radius: var(--alp-radius);
    color: var(--alp-muted);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.alp-btn-add:hover {
    border-color: var(--alp-primary);
    color: var(--alp-primary);
    background: #f8faff;
}

/* ===== Form ===== */
.alp-form {
    background: var(--alp-white);
    border-radius: 16px;
    padding: 0;
    box-shadow: none;
    border: 1px solid var(--alp-border);
    overflow: hidden;
}

.alp-form-section {
    padding: 24px;
    background: transparent;
}

.alp-form-section + .alp-form-section {
    border-top: 1px solid var(--alp-border);
}

.alp-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--alp-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.alp-field {
    margin-bottom: 20px;
}

.alp-field:last-child {
    margin-bottom: 0;
}

.alp-field label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--alp-text);
    margin-bottom: 6px;
}

.alp-field label .required {
    color: var(--alp-danger);
    font-weight: 400;
}

.alp-hint {
    font-size: 13px;
    color: var(--alp-muted);
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.alp-field input[type="text"],
.alp-field input[type="number"],
.alp-field textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: var(--alp-white);
    color: var(--alp-text);
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    outline: none;
}

.alp-field input:focus,
.alp-field textarea:focus {
    border-color: var(--alp-primary);
    box-shadow: 0 0 0 3px var(--alp-primary-light);
}

.alp-field input::placeholder,
.alp-field textarea::placeholder {
    color: #94a3b8;
}

.alp-field textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* Field row for side by side */
.alp-field-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.alp-field-half {
    flex: 1;
    margin-bottom: 0;
}

/* Select styling */
.alp-field select {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: var(--alp-white);
    color: var(--alp-text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.alp-field select:focus {
    border-color: var(--alp-primary);
    box-shadow: 0 0 0 3px var(--alp-primary-light);
}

.alp-field select:disabled {
    background-color: var(--alp-bg);
    color: var(--alp-muted);
    cursor: not-allowed;
}

/* Time display - cleaner, informational style */
.alp-time-display {
    display: flex;
    align-items: center;
    gap: var(--alp-space-3);
    padding: var(--alp-space-4) var(--alp-space-5);
    background: linear-gradient(135deg, var(--alp-primary-light) 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--alp-radius);
}

.alp-time-icon {
    font-size: 22px;
    line-height: 1;
}

.alp-time-value {
    font-size: var(--alp-font-size-lg);
    font-weight: 700;
    color: var(--alp-text);
    font-variant-numeric: tabular-nums;
}

.alp-time-hint {
    font-size: var(--alp-font-size-sm);
    color: var(--alp-muted);
}

.alp-hint {
    font-size: 13px;
    color: var(--alp-muted);
    margin: 0 0 16px 0;
}

/* Header subtitle */
.alp-header-subtitle {
    color: var(--alp-muted);
    font-size: 15px;
    margin: 4px 0 0 0;
}

/* Actions inside form (deprecated) */
.alp-actions {
    display: flex;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--alp-border);
}

/* Form Actions - Clean UI with proper hierarchy */
.alp-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--alp-space-4);
    margin: 0 var(--alp-space-6);
    padding: var(--alp-space-6) 0;
    border-top: 1px solid var(--alp-border);
}

.alp-form-actions .alp-actions-left {
    display: flex;
    align-items: center;
    gap: var(--alp-space-2);
}

.alp-form-actions .alp-actions-right {
    display: flex;
    align-items: center;
    gap: var(--alp-space-3);
}

/* Ghost button - Cancel */
.alp-form-actions .alp-btn-text {
    padding: var(--alp-space-3) var(--alp-space-4);
    font-size: var(--alp-font-size-sm);
    font-weight: 500;
    background: transparent;
    border: none;
    color: var(--alp-muted);
    text-decoration: none;
    cursor: pointer;
    border-radius: var(--alp-radius-sm);
    transition: all var(--alp-transition);
}

.alp-form-actions .alp-btn-text:hover {
    color: var(--alp-text);
    background: var(--alp-bg);
}

/* Outlined button - Save Draft */
.alp-form-actions .alp-btn-outline {
    padding: var(--alp-space-3) var(--alp-space-5);
    font-size: var(--alp-font-size-sm);
    font-weight: 600;
    border-radius: var(--alp-radius-sm);
    background: var(--alp-white);
    border: 1.5px solid var(--alp-border);
    color: var(--alp-text-secondary);
    cursor: pointer;
    transition: all var(--alp-transition);
}

.alp-form-actions .alp-btn-outline:hover {
    border-color: var(--alp-primary);
    color: var(--alp-primary);
    background: var(--alp-primary-light);
}

/* Primary button - Publish/Update */
.alp-form-actions .alp-btn-primary {
    padding: var(--alp-space-3) var(--alp-space-6);
    font-size: var(--alp-font-size-sm);
    font-weight: 600;
    border-radius: var(--alp-radius-sm);
    background: linear-gradient(135deg, var(--alp-primary) 0%, var(--alp-primary-hover) 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: all var(--alp-transition);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.alp-form-actions .alp-btn-primary:hover {
    background: linear-gradient(135deg, var(--alp-primary-hover) 0%, var(--alp-primary-dark) 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

/* Danger text button - Delete */
.alp-form-actions .alp-btn-danger-text {
    display: inline-flex;
    align-items: center;
    gap: var(--alp-space-1);
    padding: var(--alp-space-3) var(--alp-space-4);
    font-size: var(--alp-font-size-sm);
    font-weight: 500;
    background: transparent;
    border: none;
    color: var(--alp-danger);
    cursor: pointer;
    border-radius: var(--alp-radius-sm);
    transition: all var(--alp-transition);
}

.alp-form-actions .alp-btn-danger-text:hover {
    background: var(--alp-danger-light);
}

.alp-form-actions .alp-btn-danger-text svg {
    flex-shrink: 0;
    opacity: 0.8;
}

/* Form Validation Styles */
.alp-field.has-error input,
.alp-field.has-error select,
.alp-field.has-error textarea {
    border-color: var(--alp-danger) !important;
    background-color: #fef2f2 !important;
}

.alp-field.has-error label {
    color: var(--alp-danger);
}

.alp-field .alp-error-message {
    display: none;
    color: var(--alp-danger);
    font-size: 12px;
    margin-top: 4px;
}

.alp-field.has-error .alp-error-message {
    display: block;
}

.alp-resources-error {
    display: none;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--alp-danger);
    font-size: 14px;
    margin-bottom: 16px;
}

.alp-resources-error.show {
    display: block;
}

.alp-field-error {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--alp-danger);
    font-size: 14px;
    margin-top: 8px;
}

/* Actions outside form - Keep for backwards compatibility */
.alp-actions-outside {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 32px auto 40px;
    max-width: 720px;
}

.alp-actions-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alp-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alp-actions-outside .alp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.alp-actions-outside .alp-btn svg {
    flex-shrink: 0;
}

.alp-actions-outside .alp-btn-primary {
    padding: 14px 32px;
    font-size: 15px;
    border-radius: 50px;
}

.alp-actions-outside .alp-btn-outline {
    padding: 13px 28px;
    font-size: 15px;
    border-radius: 50px;
    background: var(--alp-white);
    border: 2px solid var(--alp-border);
    color: var(--alp-text);
}

.alp-actions-outside .alp-btn-outline:hover {
    border-color: var(--alp-primary);
    color: var(--alp-primary);
    background: #f8faff;
}

.alp-actions-outside .alp-btn-danger-outline {
    padding: 13px 24px;
    font-size: 15px;
    border-radius: 50px;
    background: var(--alp-white);
    border: 2px solid #fecaca;
    color: var(--alp-danger);
}

.alp-actions-outside .alp-btn-danger-outline:hover {
    border-color: var(--alp-danger);
    background: #fef2f2;
}

/* Spin animation for loading */
@keyframes alp-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.alp-spin {
    animation: alp-spin 1s linear infinite;
}

/* ===== Resources in Editor ===== */
#alp-resources {
    margin-bottom: 16px;
}

.alp-empty {
    text-align: center;
    padding: 40px;
    color: var(--alp-muted);
    background: var(--alp-bg);
    border-radius: 8px;
}

.alp-resource {
    background: var(--alp-bg);
    border: 1px solid var(--alp-border);
    border-radius: var(--alp-radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.alp-resource-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--alp-border);
    transition: background 0.2s;
}

.alp-resource-header:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.alp-drag-handle {
    cursor: grab;
    color: var(--alp-muted);
    font-size: 16px;
    padding: 4px;
    user-select: none;
    flex-shrink: 0;
    letter-spacing: -2px;
}
.alp-drag-handle:hover {
    color: var(--alp-primary);
}
.alp-drag-handle:active {
    cursor: grabbing;
}

/* Sortable states */
.alp-sortable-ghost {
    opacity: 0.4;
    background: var(--alp-primary);
}
.alp-sortable-ghost .alp-resource-header {
    background: #e0e7ff;
}
.alp-sortable-chosen {
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}
.alp-sortable-drag {
    opacity: 1;
}

.alp-resource-num {
    width: 32px;
    height: 32px;
    background: var(--alp-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.alp-resource-title {
    flex: 1;
}
.alp-resource-title strong {
    display: block;
    font-size: 16px;
    color: var(--alp-text);
    margin-bottom: 4px;
}
.alp-resource-title p {
    margin: 0;
    font-size: 14px;
    color: var(--alp-muted);
    line-height: 1.5;
}

/* Resource description in editor */
.alp-res-description {
    font-size: 13px;
    color: var(--alp-muted);
    margin: 4px 0 8px 0;
    line-height: 1.5;
}

/* Resource meta line in editor */
.alp-res-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
}
.alp-res-meta-line span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.alp-res-meta-line .alp-meta-svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* Resource actions (toggle + delete) */
.alp-resource-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.alp-toggle-h5p {
    background: none;
    border: none;
    color: var(--alp-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}
.alp-toggle-h5p:hover {
    background: var(--alp-bg);
    color: var(--alp-primary);
}

/* Toggle icons */
.alp-toggle-h5p .alp-icon-collapse {
    display: none;
}
.alp-resource.is-expanded .alp-toggle-h5p .alp-icon-expand {
    display: none;
}
.alp-resource.is-expanded .alp-toggle-h5p .alp-icon-collapse {
    display: block;
}

.alp-remove-resource {
    background: none;
    border: none;
    color: var(--alp-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}
.alp-remove-resource:hover {
    color: var(--alp-danger);
}

/* Collapsible H5P content */
.alp-resource-h5p {
    padding: 16px;
    transition: all 0.3s ease;
    background: var(--alp-white);
    overflow: hidden;
}

.alp-resource-h5p.collapsed {
    display: none;
}

.alp-h5p-iframe {
    width: 100%;
    min-height: 400px;
    border: none;
    border-radius: 8px;
    background: var(--alp-white);
}

/* Old resources styles - REMOVED, using new card styles */

.alp-resource-section {
    background: var(--alp-white);
    border-radius: var(--alp-radius);
    margin-bottom: 24px;
    box-shadow: var(--alp-shadow);
    overflow: hidden;
}

.alp-resource-info {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--alp-border);
}

.alp-step-number {
    width: 40px;
    height: 40px;
    background: var(--alp-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.alp-resource-details {
    flex: 1;
}

.alp-resource-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.alp-resource-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--alp-text);
}

.alp-resource-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--alp-bg);
    border: 1px solid var(--alp-border);
    border-radius: 8px;
    color: var(--alp-muted);
    text-decoration: none;
    transition: all 0.15s;
    flex-shrink: 0;
}
.alp-resource-link:hover {
    background: var(--alp-primary);
    border-color: var(--alp-primary);
    color: white;
}

.alp-resource-desc {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--alp-muted);
    line-height: 1.5;
}

/* Resource metadata in single view */
.alp-resource-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}
.alp-res-meta-item {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

.alp-h5p-container {
    padding: 20px;
}

/* ===== Path Metadata Grid ===== */
.alp-path-meta {
    background: var(--alp-bg);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.alp-path-meta-bottom {
    margin-top: 32px;
}

.alp-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.alp-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alp-meta-item .alp-meta-svg {
    flex-shrink: 0;
    color: var(--alp-primary);
    opacity: 0.8;
    margin-top: 2px;
}

.alp-meta-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alp-meta-label {
    font-size: 12px;
    color: var(--alp-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alp-meta-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--alp-text);
}

/* ===== Modal - Improved ===== */
.alp-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: var(--alp-space-5);
}
.alp-modal.open {
    display: flex;
}

.alp-modal-box {
    background: var(--alp-white);
    border-radius: var(--alp-radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--alp-shadow-lg), 0 0 0 1px rgba(0,0,0,0.05);
    animation: alp-modal-in 0.2s ease-out;
}

@keyframes alp-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.alp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--alp-space-5) var(--alp-space-6);
    border-bottom: 1px solid var(--alp-border);
    background: var(--alp-bg);
}
.alp-modal-header h2 {
    margin: 0;
    font-size: var(--alp-font-size-lg);
    font-weight: 600;
    color: var(--alp-text);
}

.alp-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--alp-white);
    border: 1px solid var(--alp-border);
    border-radius: var(--alp-radius-sm);
    font-size: 18px;
    color: var(--alp-muted);
    cursor: pointer;
    transition: all var(--alp-transition-fast);
}

.alp-modal-close:hover {
    background: var(--alp-danger-light);
    border-color: var(--alp-danger-border);
    color: var(--alp-danger);
}

.alp-modal-body {
    padding: var(--alp-space-5) var(--alp-space-6);
    overflow-y: auto;
}

.alp-modal-body input[type="text"] {
    width: 100%;
    padding: var(--alp-space-3) var(--alp-space-4);
    font-size: var(--alp-font-size-base);
    border: 1.5px solid var(--alp-border);
    border-radius: var(--alp-radius-sm);
    margin-bottom: var(--alp-space-4);
    box-sizing: border-box;
    transition: border-color var(--alp-transition-fast), box-shadow var(--alp-transition-fast);
}

.alp-modal-body input[type="text"]:focus {
    outline: none;
    border-color: var(--alp-primary);
    box-shadow: var(--alp-shadow-focus);
}

/* Tabs - Improved */
.alp-tabs {
    display: flex;
    gap: var(--alp-space-1);
    margin-bottom: var(--alp-space-4);
    padding: var(--alp-space-1);
    background: var(--alp-bg);
    border-radius: var(--alp-radius-sm);
}

.alp-tab {
    flex: 1;
    padding: var(--alp-space-3) var(--alp-space-4);
    background: none;
    border: none;
    font-size: var(--alp-font-size-sm);
    font-weight: 500;
    color: var(--alp-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--alp-transition-fast);
}

.alp-tab:hover {
    background: var(--alp-bg);
    color: var(--alp-text);
}

.alp-tab.active {
    background: var(--alp-primary);
    color: white;
}

#alp-resource-list {
    display: flex;
    flex-direction: column;
    gap: var(--alp-space-2);
}

.alp-resource-option {
    display: flex;
    align-items: flex-start;
    gap: var(--alp-space-3);
    padding: var(--alp-space-4);
    border: 1.5px solid var(--alp-border);
    border-radius: var(--alp-radius);
    cursor: pointer;
    transition: all var(--alp-transition-fast);
    background: var(--alp-white);
}
.alp-resource-option:hover {
    border-color: var(--alp-primary);
    background: var(--alp-primary-light);
    box-shadow: var(--alp-shadow-sm);
}

.alp-resource-option .info {
    flex: 1;
    min-width: 0;
}
.alp-resource-option .info strong {
    display: block;
    font-size: var(--alp-font-size-base);
    font-weight: 600;
    color: var(--alp-text);
    margin-bottom: var(--alp-space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.alp-res-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--alp-space-2);
    font-size: var(--alp-font-size-xs);
    color: var(--alp-muted);
    margin-bottom: var(--alp-space-1);
}
.alp-res-meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.alp-res-desc {
    margin: 0;
    font-size: var(--alp-font-size-sm);
    color: var(--alp-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alp-loading {
    text-align: center;
    padding: var(--alp-space-10);
    color: var(--alp-muted);
}

/* ===== Cards Grid ===== */
.alp-archive-page .alp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.alp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.alp-card {
    background: var(--alp-white);
    border-radius: var(--alp-radius);
    overflow: hidden;
    box-shadow: var(--alp-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.alp-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -5px rgba(0,0,0,0.15);
}

.alp-card-image {
    display: block;
    aspect-ratio: 16/9;
    background: var(--alp-bg);
}
.alp-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.alp-card-body {
    padding: 20px;
}

.alp-card-body h2 {
    font-size: 18px;
    margin: 0 0 8px 0;
}
.alp-card-body h2 a {
    color: var(--alp-text);
    text-decoration: none;
}
.alp-card-body h2 a:hover {
    color: var(--alp-primary);
}

.alp-card-body > p {
    font-size: 14px;
    color: var(--alp-muted);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.alp-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--alp-muted);
    margin-bottom: 16px;
}

.alp-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.alp-card-icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.alp-btn-icon {
    flex-shrink: 0;
    margin-right: 4px;
}

.alp-card-actions {
    display: flex;
    gap: 12px;
}

.alp-card-actions .alp-btn {
    display: inline-flex;
    align-items: center;
}

/* ===== Empty State ===== */
.alp-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--alp-white);
    border-radius: var(--alp-radius);
    box-shadow: var(--alp-shadow);
}

.alp-empty-icon {
    margin-bottom: 16px;
    color: var(--alp-primary);
    opacity: 0.5;
}

.alp-empty-icon svg {
    width: 64px;
    height: 64px;
}

.alp-empty-state h2 {
    margin: 0 0 8px 0;
    color: var(--alp-text);
}

.alp-empty-state p {
    color: var(--alp-muted);
    margin: 0 0 20px 0;
}

.alp-empty-notice {
    text-align: center;
    padding: 40px;
    background: var(--alp-white);
    border-radius: var(--alp-radius);
    color: var(--alp-muted);
}

/* ===== Archive V2 - Modern Design ===== */
.alp-archive-v2 {
    max-width: 1100px;
}

/* Hero Header - Improved */
.alp-archive-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--alp-space-6);
    margin-bottom: var(--alp-space-8);
    padding: var(--alp-space-8) var(--alp-space-10);
    background: linear-gradient(135deg, var(--alp-bg) 0%, var(--alp-border-light) 100%);
    border-radius: var(--alp-radius-xl);
    border: 1px solid var(--alp-border);
}

.alp-hero-content {
    flex: 1;
}

.alp-hero-title {
    font-size: var(--alp-font-size-3xl);
    font-weight: 700;
    color: var(--alp-text);
    margin: 0 0 var(--alp-space-2) 0;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.alp-hero-subtitle {
    font-size: var(--alp-font-size-base);
    color: var(--alp-muted);
    margin: 0;
    line-height: 1.5;
}

.alp-btn-hero {
    display: inline-flex;
    align-items: center;
    gap: var(--alp-space-2);
    padding: var(--alp-space-4) var(--alp-space-6);
    font-size: var(--alp-font-size-base);
    font-weight: 600;
    border-radius: var(--alp-radius-full);
    white-space: nowrap;
    background: linear-gradient(135deg, var(--alp-primary) 0%, var(--alp-primary-hover) 100%);
    color: white;
    border: none;
    text-decoration: none;
    transition: all var(--alp-transition);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.alp-btn-hero:hover {
    background: linear-gradient(135deg, var(--alp-primary-hover) 0%, var(--alp-primary-dark) 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
    transform: translateY(-2px);
    color: white;
}

/* Stats Bar - Improved visual consistency */
.alp-stats-bar {
    display: flex;
    gap: var(--alp-space-2);
    margin-bottom: var(--alp-space-6);
    padding: var(--alp-space-3) var(--alp-space-4);
    background: var(--alp-white);
    border-radius: var(--alp-radius);
    border: 1px solid var(--alp-border);
}

.alp-stat-item {
    display: flex;
    flex-direction: column;
    padding: var(--alp-space-3) var(--alp-space-5);
    border-radius: var(--alp-radius-sm);
    transition: background-color var(--alp-transition-fast);
    min-width: 100px;
}

.alp-stat-item:hover {
    background: var(--alp-bg);
}

.alp-stat-value {
    font-size: var(--alp-font-size-2xl);
    font-weight: 700;
    color: var(--alp-text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.alp-stat-label {
    font-size: var(--alp-font-size-xs);
    color: var(--alp-muted);
    margin-top: var(--alp-space-1);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Draft stat - subtle indicator without breaking visual rhythm */
.alp-stat-draft {
    position: relative;
}

.alp-stat-draft::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 28px;
    background: var(--alp-warning);
    border-radius: 2px;
}

.alp-stat-draft .alp-stat-value {
    color: var(--alp-warning);
}

/* Toolbar */
.alp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.alp-tabs-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--alp-bg);
    padding: 4px;
    border-radius: 10px;
}

.alp-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--alp-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    box-sizing: border-box;
}

.alp-tab-btn:hover {
    color: var(--alp-text);
    background: var(--alp-white);
}

.alp-tab-btn.active {
    color: var(--alp-primary);
    background: var(--alp-white);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.alp-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--alp-primary-light);
    color: var(--alp-primary);
    border-radius: 10px;
}

.alp-tab-count-draft {
    background: #fef3c7;
    color: #d97706;
}

.alp-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search Box - High specificity to override theme */
.alp-archive-v2 .alp-toolbar-right .alp-search-box {
    display: flex !important;
    align-items: center !important;
    position: relative !important;
    width: 150px !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
}

.alp-archive-v2 .alp-search-box:focus-within {
    border-color: #255afd !important;
    box-shadow: 0 0 0 3px rgba(37, 90, 253, 0.1) !important;
}

.alp-archive-v2 .alp-search-box .alp-search-box-icon {
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 14px !important;
    height: 14px !important;
    color: #94a3b8 !important;
    pointer-events: none !important;
}

.alp-archive-v2 .alp-search-box .alp-search-box-input {
    width: 100% !important;
    height: 100% !important;
    padding: 0 24px 0 30px !important;
    margin: 0 !important;
    font-size: 13px !important;
    font-family: inherit !important;
    color: #1e293b !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.alp-archive-v2 .alp-search-box .alp-search-box-input::placeholder {
    color: #94a3b8 !important;
}

.alp-archive-v2 .alp-search-box .alp-search-box-clear {
    position: absolute !important;
    right: 4px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    line-height: 1 !important;
    color: #94a3b8 !important;
    background: none !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    padding: 0 !important;
}

.alp-archive-v2 .alp-search-box .alp-search-box-clear:hover {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

/* Sort Dropdown */
.alp-sort-dropdown {
    position: relative;
}

.alp-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--alp-text);
    background: var(--alp-white);
    border: 1px solid var(--alp-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-sizing: border-box;
}

.alp-sort-btn:hover {
    border-color: var(--alp-primary);
}

.alp-sort-chevron {
    opacity: 0.5;
    transition: transform 0.2s;
}

.alp-sort-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 160px;
    background: var(--alp-white);
    border: 1px solid var(--alp-border);
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s;
    z-index: 100;
}

.alp-sort-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.alp-sort-option {
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--alp-text);
    text-decoration: none;
    transition: background 0.15s;
}

.alp-sort-option:first-child {
    border-radius: 9px 9px 0 0;
}

.alp-sort-option:last-child {
    border-radius: 0 0 9px 9px;
}

.alp-sort-option:hover {
    background: var(--alp-bg);
}

.alp-sort-option.active {
    color: var(--alp-primary);
    background: var(--alp-primary-light);
}

/* Search Results Info */
.alp-search-results-info {
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--alp-muted);
    background: var(--alp-bg);
    border-radius: 8px;
}

.alp-search-count {
    color: var(--alp-text);
}

/* Grid V2 */
.alp-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--alp-space-5);
}

/* Card V2 - Improved visual hierarchy */
.alp-card-v2 {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--alp-white);
    border: 1px solid var(--alp-border);
    border-radius: var(--alp-radius-lg);
    overflow: hidden;
    transition: all var(--alp-transition);
}

.alp-card-v2:hover {
    border-color: var(--alp-primary);
    box-shadow: var(--alp-shadow-md), 0 0 0 1px rgba(37, 99, 235, 0.05);
    transform: translateY(-3px);
}

.alp-card-v2.is-draft {
    border-color: var(--alp-warning-border);
    background: linear-gradient(180deg, var(--alp-warning-light) 0%, var(--alp-white) 80px);
}

.alp-card-v2.is-draft:hover {
    border-color: var(--alp-warning);
    box-shadow: var(--alp-shadow-md), 0 0 0 1px rgba(217, 119, 6, 0.1);
}

.alp-card-badge {
    position: absolute;
    top: var(--alp-space-3);
    left: var(--alp-space-3);
    display: inline-flex;
    align-items: center;
    gap: var(--alp-space-1);
    padding: var(--alp-space-1) var(--alp-space-2);
    font-size: var(--alp-font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--alp-radius-sm);
    z-index: 2;
}

.alp-badge-draft {
    background: var(--alp-warning-light);
    color: var(--alp-warning);
    border: 1px solid var(--alp-warning-border);
}

.alp-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.alp-card-header-v2 {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--alp-space-4) var(--alp-space-4) 0 var(--alp-space-4);
    min-height: 72px;
}

.alp-card-icon-single {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--alp-bg) 0%, var(--alp-border-light) 100%);
    border-radius: var(--alp-radius);
    color: var(--alp-muted);
    flex-shrink: 0;
}

.alp-card-icon-single img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.alp-card-icon-single svg {
    width: 26px;
    height: 26px;
    opacity: 0.6;
}

.alp-card-meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--alp-space-1);
    justify-content: flex-end;
    max-width: 55%;
}

.alp-pill {
    display: inline-block;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--alp-primary);
    background: var(--alp-primary-light);
    border-radius: var(--alp-radius-full);
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.alp-pill-subject {
    background: var(--alp-success-light);
    color: var(--alp-success);
}

.alp-card-body-v2 {
    padding: var(--alp-space-4);
    flex: 1;
}

.alp-card-title-v2 {
    font-size: var(--alp-font-size-lg);
    font-weight: 600;
    color: var(--alp-text);
    margin: 0 0 var(--alp-space-2) 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.2px;
}

.alp-card-desc-v2 {
    font-size: var(--alp-font-size-sm);
    color: var(--alp-muted);
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alp-card-footer-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--alp-space-3) var(--alp-space-4);
    border-top: 1px solid var(--alp-border-light);
    background: var(--alp-bg);
}

.alp-card-author {
    display: flex;
    align-items: center;
    gap: var(--alp-space-2);
    min-width: 0;
    flex: 1;
}

.alp-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.alp-author-name {
    font-size: var(--alp-font-size-sm);
    color: var(--alp-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alp-card-stats {
    display: flex;
    gap: var(--alp-space-3);
    flex-shrink: 0;
}

.alp-card-stat {
    display: inline-flex;
    align-items: center;
    gap: var(--alp-space-1);
    font-size: var(--alp-font-size-sm);
    color: var(--alp-text-secondary);
    font-weight: 500;
}

.alp-card-stat svg {
    opacity: 0.5;
}

/* Duration stat - more prominent */
.alp-card-stat:last-child {
    background: var(--alp-primary-light);
    color: var(--alp-primary);
    padding: 3px 8px;
    border-radius: var(--alp-radius-full);
    font-size: 12px;
}

.alp-card-stat:last-child svg {
    opacity: 0.7;
}

.alp-card-edit-btn {
    position: absolute;
    top: var(--alp-space-3);
    right: var(--alp-space-3);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--alp-white);
    border: 1px solid var(--alp-border);
    border-radius: var(--alp-radius-sm);
    color: var(--alp-muted);
    text-decoration: none;
    opacity: 0;
    transform: scale(0.9);
    transition: all var(--alp-transition);
    z-index: 3;
    box-shadow: var(--alp-shadow-sm);
}

.alp-card-v2:hover .alp-card-edit-btn {
    opacity: 1;
    transform: scale(1);
}

.alp-card-edit-btn:hover {
    background: var(--alp-primary);
    border-color: var(--alp-primary);
    color: white;
    box-shadow: var(--alp-shadow);
}

/* Empty State V2 */
.alp-empty-state-v2 {
    text-align: center;
    padding: 80px 40px;
    background: var(--alp-white);
    border: 1px solid var(--alp-border);
    border-radius: 16px;
}

.alp-empty-state-v2 .alp-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    background: var(--alp-bg);
    border-radius: 50%;
    color: var(--alp-muted);
}

.alp-empty-state-v2 .alp-empty-icon svg {
    width: 40px;
    height: 40px;
}

.alp-empty-state-v2 h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--alp-text);
    margin: 0 0 8px 0;
}

.alp-empty-state-v2 p {
    font-size: 15px;
    color: var(--alp-muted);
    margin: 0 0 24px 0;
}

/* ===== Pagination ===== */
.alp-pagination {
    margin-top: 40px;
    text-align: center;
}

/* ===== Resources Section Header ===== */
.alp-resources-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 32px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--alp-border);
}

.alp-resources-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--alp-text);
    margin: 0;
}

.alp-toggle-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--alp-white);
    border: 1px solid var(--alp-border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--alp-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.alp-toggle-all-btn:hover {
    border-color: var(--alp-primary);
    color: var(--alp-primary);
    background: #f8faff;
}

.alp-toggle-all-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.alp-toggle-all-btn.is-expanded svg {
    transform: rotate(180deg);
}

/* ===== Resource Cards (Single View) ===== */
.alp-resources-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 0;
    position: relative;
}

.alp-resource-card {
    background: var(--alp-white);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: visible;
    transition: all 0.2s ease;
    position: relative;
}

.alp-resource-card:hover {
    border-color: var(--alp-primary);
    box-shadow: 0 2px 8px rgba(37, 90, 253, 0.08);
}

.alp-resource-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--alp-white);
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 12px;
}

.alp-resource-card:not(.is-collapsed) .alp-resource-card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}

.alp-resource-card-header:hover {
    background: #f8fafc;
}

.alp-resource-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    min-width: 52px;
    background: var(--alp-primary-light);
    border-radius: 12px;
    color: var(--alp-primary);
}

.alp-resource-icon svg {
    width: 28px;
    height: 28px;
}

.alp-resource-icon .alp-h5p-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.alp-resource-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.alp-resource-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--alp-text);
    margin: 0;
    line-height: 1.4;
}

.alp-resource-card-description {
    font-size: 13px;
    color: var(--alp-muted);
    line-height: 1.5;
    margin: 4px 0 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alp-resource-card:not(.is-collapsed) .alp-resource-card-description {
    -webkit-line-clamp: 2;
}

.alp-resource-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.alp-resource-info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    transition: all 0.2s;
    cursor: pointer;
}

.alp-resource-info-btn:hover,
.alp-resource-info-btn.active {
    background: var(--alp-primary-light);
    color: var(--alp-primary);
}

/* When popup is active, bring card to front */
.alp-resource-card:has(.alp-resource-info-btn.active),
.alp-resource-card.popup-active {
    z-index: 100;
}

.alp-resource-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #94a3b8;
    transition: color 0.2s;
}

.alp-resource-card-header:hover .alp-resource-toggle-icon {
    color: var(--alp-primary);
}

/* Info popup */
.alp-resource-meta-popup {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--alp-white);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 1000;
}

.alp-resource-info-btn.active + .alp-resource-meta-popup {
    display: block;
}

.alp-meta-popup-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--alp-text);
    padding: 8px 14px;
    transition: background 0.15s;
}

.alp-meta-popup-item:hover {
    background: #f8fafc;
}

.alp-meta-popup-item svg {
    flex-shrink: 0;
    color: var(--alp-muted);
}

.alp-meta-popup-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--alp-primary);
    padding: 10px 14px;
    border-top: 1px solid #e2e8f0;
    margin-top: 4px;
    text-decoration: none;
    transition: background 0.15s;
}

.alp-meta-popup-link:hover {
    background: var(--alp-primary-light);
}

.alp-meta-popup-link svg {
    flex-shrink: 0;
}

.alp-resource-card-content {
    padding: 20px;
    background: var(--alp-white);
    border-top: 1px solid #f1f5f9;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

/* Toggle icons in view mode - by default cards are expanded */
.alp-resource-toggle-icon .alp-icon-expand {
    display: none;
}
.alp-resource-toggle-icon .alp-icon-collapse {
    display: block;
}
.alp-resource-card.is-collapsed .alp-resource-toggle-icon .alp-icon-expand {
    display: block;
}
.alp-resource-card.is-collapsed .alp-resource-toggle-icon .alp-icon-collapse {
    display: none;
}
.alp-resource-card.is-collapsed .alp-resource-card-content {
    display: none;
}

/* Collapsed state refinements */
.alp-resource-card.is-collapsed {
    border-color: #e2e8f0;
}

.alp-resource-card.is-collapsed:hover {
    border-color: var(--alp-primary);
    transform: translateY(-1px);
}

.alp-resource-card.is-collapsed .alp-resource-icon {
    background: #f1f5f9;
    color: #64748b;
}

.alp-resource-card.is-collapsed:hover .alp-resource-icon {
    background: var(--alp-primary-light);
    color: var(--alp-primary);
}

/* Hide WordPress admin bar inside H5P iframe */
.alp-resource-card-content iframe {
    border-radius: 12px;
    overflow: hidden;
}

.alp-resource-card-content .h5p-content,
.alp-resource-card-content .h5p-iframe-wrapper {
    border-radius: 12px;
    overflow: hidden;
}

/* Title row in single header */
.alp-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.alp-title-row h1 {
    margin: 0;
    flex: 1;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .alp-container {
        padding: 20px 16px;
    }
    
    .alp-header h1 {
        font-size: 24px;
    }
    
    .alp-form {
        border-radius: 12px;
    }
    
    .alp-form-section {
        padding: 20px 16px;
    }
    
    .alp-section-title {
        font-size: 12px;
    }
    
    .alp-actions {
        flex-direction: column;
    }
    
    .alp-actions-outside {
        flex-direction: column;
        padding: 0 16px;
        margin: 24px auto 32px;
        gap: 16px;
    }
    
    .alp-actions-left,
    .alp-actions-right {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .alp-actions-outside .alp-btn-primary,
    .alp-actions-outside .alp-btn-outline,
    .alp-actions-outside .alp-btn-danger-outline {
        width: 100%;
        justify-content: center;
    }
    
    /* Form actions responsive */
    .alp-form-actions {
        flex-direction: column;
        gap: 16px;
        margin: 0 16px;
        padding: 20px 0;
    }
    
    .alp-form-actions .alp-actions-left {
        width: 100%;
        order: 2;
        justify-content: center;
        gap: 16px;
    }
    
    .alp-form-actions .alp-actions-right {
        width: 100%;
        flex-direction: column;
        gap: 10px;
        order: 1;
    }
    
    .alp-form-actions .alp-btn-primary,
    .alp-form-actions .alp-btn-outline {
        width: 100%;
        justify-content: center;
    }
    
    .alp-form-actions .alp-btn-text,
    .alp-form-actions .alp-btn-danger-text {
        padding: 12px 16px;
    }
    
    .alp-grid {
        grid-template-columns: 1fr;
    }
    
    .alp-field-row {
        flex-direction: column;
        gap: 0;
    }
    
    .alp-field-half {
        margin-bottom: 20px;
    }
    
    /* iOS zoom prevention */
    .alp-field input[type="text"],
    .alp-field input[type="number"],
    .alp-field select,
    .alp-field textarea {
        font-size: 16px;
    }
    
    /* Meta grid */
    .alp-meta-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    /* Resource meta */
    .alp-res-meta-line {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Resource cards mobile */
    .alp-resource-card-header {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .alp-resource-number {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    .alp-resource-card-title {
        font-size: 16px;
    }
    
    .alp-resource-card-description {
        font-size: 13px;
    }
    
    .alp-resource-card-meta {
        gap: 8px;
    }
    
    .alp-resource-meta-item {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    .alp-resource-card-content {
        padding: 16px;
    }
    
    .alp-title-row {
        flex-direction: column;
        gap: 12px;
    }
    
    /* Archive V2 Mobile */
    .alp-archive-hero {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px;
    }
    
    .alp-hero-title {
        font-size: 22px;
    }
    
    .alp-btn-hero {
        width: 100%;
        justify-content: center;
    }
    
    .alp-stats-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
        padding: 12px;
    }
    
    .alp-stat-item {
        padding: 8px 12px;
        min-width: calc(50% - 8px);
        text-align: center;
    }
    
    .alp-stat-value {
        font-size: 20px;
    }
    
    .alp-toolbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .alp-tabs-wrapper {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    
    .alp-tab-btn {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .alp-toolbar-right {
        width: 100%;
        flex-direction: column;
    }
    
    .alp-search-form {
        width: 100%;
    }
    
    .alp-search-input-wrapper {
        width: 100%;
    }
    
    .alp-search-input {
        width: 100%;
    }
    
    .alp-sort-dropdown {
        width: 100%;
    }
    
    .alp-sort-btn {
        width: 100%;
        justify-content: space-between;
    }
    
    .alp-sort-menu {
        left: 0;
        right: 0;
    }
    
    .alp-grid-v2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .alp-card-header-v2 {
        flex-direction: column;
        gap: 12px;
    }
    
    .alp-card-meta-pills {
        justify-content: flex-start;
    }
    
    .alp-card-edit-btn {
        opacity: 1;
        transform: scale(1);
    }
    
    .alp-empty-state-v2 {
        padding: 60px 20px;
    }
}

/* ==============================================
   TOAST NOTIFICATIONS - Improved
   ============================================== */

.alp-toast {
    position: fixed;
    top: var(--alp-space-6);
    right: var(--alp-space-6);
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: var(--alp-space-3);
    padding: var(--alp-space-4) var(--alp-space-5);
    border-radius: var(--alp-radius);
    box-shadow: var(--alp-shadow-lg);
    font-size: var(--alp-font-size-sm);
    font-weight: 500;
    transform: translateX(120%);
    opacity: 0;
    transition: transform var(--alp-transition-slow), opacity var(--alp-transition-slow);
    max-width: 400px;
}

.alp-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.alp-toast-success {
    background: linear-gradient(135deg, var(--alp-success) 0%, #15803d 100%);
    color: #fff;
}

.alp-toast-error {
    background: linear-gradient(135deg, var(--alp-danger) 0%, #b91c1c 100%);
    color: #fff;
}

.alp-toast-info {
    background: linear-gradient(135deg, var(--alp-primary) 0%, var(--alp-primary-hover) 100%);
    color: #fff;
}

.alp-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alp-toast-message {
    flex: 1;
    line-height: 1.45;
}

.alp-toast-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--alp-transition-fast);
}

.alp-toast-close:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

@media (max-width: 480px) {
    .alp-toast {
        top: auto;
        bottom: 24px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* ==============================================
   CONFIRM MODAL - Improved Design
   ============================================== */

.alp-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--alp-space-4);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--alp-transition-slow), visibility var(--alp-transition-slow);
}

.alp-confirm-modal.show {
    opacity: 1;
    visibility: visible;
}

.alp-confirm-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.alp-confirm-box {
    position: relative;
    background: var(--alp-white);
    border-radius: var(--alp-radius-xl);
    padding: var(--alp-space-8);
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--alp-shadow-lg), 0 0 0 1px rgba(0,0,0,0.05);
    transform: scale(0.95) translateY(10px);
    transition: transform var(--alp-transition-slow);
}

.alp-confirm-modal.show .alp-confirm-box {
    transform: scale(1) translateY(0);
}

.alp-confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--alp-space-5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--alp-warning-light);
    color: var(--alp-warning);
}

.alp-confirm-icon.danger {
    background: var(--alp-danger-light);
    color: var(--alp-danger);
}

.alp-confirm-icon svg {
    width: 28px;
    height: 28px;
}

.alp-confirm-title {
    font-size: var(--alp-font-size-lg);
    font-weight: 600;
    color: var(--alp-text);
    margin: 0 0 var(--alp-space-2);
}

.alp-confirm-message {
    font-size: var(--alp-font-size-base);
    color: var(--alp-muted);
    margin: 0 0 var(--alp-space-6);
    line-height: 1.6;
}

.alp-confirm-message strong {
    color: var(--alp-text);
    font-weight: 600;
}

.alp-confirm-hint {
    font-size: var(--alp-font-size-sm);
    color: var(--alp-muted);
    margin: var(--alp-space-3) 0 0;
    padding: var(--alp-space-3);
    background: var(--alp-bg);
    border-radius: var(--alp-radius-sm);
}

.alp-confirm-actions {
    display: flex;
    gap: var(--alp-space-3);
    justify-content: center;
}

.alp-confirm-actions .alp-btn {
    min-width: 120px;
    padding: var(--alp-space-3) var(--alp-space-6);
    font-weight: 500;
}

/* Danger button for delete actions */
.alp-btn-danger {
    background: linear-gradient(135deg, var(--alp-danger) 0%, #b91c1c 100%);
    color: #fff;
    border: none;
}

.alp-btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}
