/*
 * Curricu:lr — Plugin Frontend CSS
 * Styles für den Shortcode-Frontend (Terminplan-Tabelle + Kalenderansicht).
 * Design-Tokens via WordPress-Enqueue aus design-tokens.css geladen.
 *
 * @since 4.0.0
 */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════ */

.gtp-header-logo {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}

.gtp-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ═══════════════════════════════════════════════════════════════
   QUARTER TABS (Navigation)
   ═══════════════════════════════════════════════════════════════ */

.gtp-tabs {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    background: var(--primary-900);
    flex-wrap: wrap;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.gtp-tab {
    padding: 6px var(--space-md);
    border-radius: var(--radius-btn);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
}

.gtp-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-on-dark);
}

.gtp-tab.active,
.gtp-tab[aria-selected="true"] {
    background: var(--primary-700);
    color: var(--text-on-dark);
    border-color: var(--primary-700);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

.gtp-tab .gtp-current-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-warning);
    margin-left: 5px;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   FILTER BAR
   ═══════════════════════════════════════════════════════════════ */

.gtp-filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-surface-solid);
    border-bottom: 1px solid var(--border-strong);
    flex-wrap: wrap;
}

.gtp-filter-pill {
    padding: 4px var(--space-md);
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-strong);
    background: var(--bg-body);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
    white-space: nowrap;
}

.gtp-filter-pill:hover {
    border-color: var(--primary-700);
    color: var(--primary-700);
    background: var(--primary-100);
}

.gtp-filter-pill.active {
    background: var(--primary-700);
    border-color: var(--primary-700);
    color: var(--text-on-dark);
}

.gtp-filter-toggle {
    padding: 5px var(--space-md);
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-strong);
    background: var(--bg-body);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
}

.gtp-filter-toggle:hover {
    border-color: var(--primary-700);
    color: var(--primary-700);
}

.gtp-search {
    padding: 6px var(--space-md);
    border-radius: var(--radius-input);
    border: 1px solid var(--border-input);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--text-main);
    background: var(--bg-surface-solid);
    transition: border-color var(--transition), box-shadow var(--transition);
    min-width: 180px;
}

.gtp-search:focus {
    outline: none;
    border-color: var(--primary-700);
    box-shadow: var(--shadow-focus);
}

/* ═══════════════════════════════════════════════════════════════
   EVENT TABLE
   ═══════════════════════════════════════════════════════════════ */

.gt {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.gt thead th {
    background: var(--primary-900);
    color: var(--text-on-dark);
    padding: 10px var(--space-md);
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: none;
    white-space: nowrap;
}

.gt tbody tr {
    border-bottom: 1px solid var(--border-strong);
    transition: background var(--transition);
}

.gt tbody tr:last-child {
    border-bottom: none;
}

.gt tbody tr:hover {
    background: var(--primary-100);
}

.gt td {
    padding: 10px var(--space-md);
    color: var(--text-main);
    vertical-align: middle;
}

/* Weekend / holiday rows */
.gt-hol td,
.gt tr.gt-hol td {
    background: var(--bg-muted);
    color: var(--text-muted);
    font-style: italic;
}

/* Schulwochen-Header rows */
.gt-sw td,
.gt tr.gt-sw td {
    background: var(--primary-100);
    color: var(--primary-900);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    padding: 6px var(--space-md);
    border-top: 2px solid var(--primary-700);
}

/* ═══════════════════════════════════════════════════════════════
   CATEGORY BADGES
   ═══════════════════════════════════════════════════════════════ */

.gtp-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-badge);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   CARDS (Kalenderansicht)
   ═══════════════════════════════════════════════════════════════ */

.gtp-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-lg);
    transition: transform var(--transition), box-shadow var(--transition);
}

.gtp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
}

.gtp-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 var(--space-xs) 0;
}

.gtp-card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Grid for calendar card view */
.gtp-fluid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.gtp-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px var(--space-lg);
    border-radius: var(--radius-btn);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    text-decoration: none;
    line-height: 1;
}

.gtp-btn-primary {
    background: var(--primary-700);
    color: var(--text-on-dark);
    box-shadow: var(--shadow-btn);
}

.gtp-btn-primary:hover {
    background: var(--primary-500);
    box-shadow: 0 4px 12px rgba(0, 70, 125, 0.35);
    transform: translateY(-1px);
    color: var(--text-on-dark);
    text-decoration: none;
}

.gtp-btn-primary:active {
    transform: none;
    box-shadow: var(--shadow-btn);
}

.gtp-btn-secondary {
    background: transparent;
    color: var(--primary-700);
    border: 1.5px solid var(--primary-700);
}

.gtp-btn-secondary:hover {
    background: var(--primary-100);
    text-decoration: none;
}

.gtp-btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
}

.gtp-btn-ghost:hover {
    color: var(--text-main);
    border-color: var(--border-input);
    background: var(--bg-body);
}

.gtp-btn:disabled,
.gtp-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.gtp-btn-sm {
    padding: 5px 14px;
    font-size: 0.82rem;
}

.gtp-btn-lg {
    padding: 11px 28px;
    font-size: 0.95rem;
}

/* Icon button (square) */
.gtp-btn-icon {
    padding: 6px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gtp-btn-icon:hover {
    color: var(--primary-700);
    border-color: var(--primary-700);
    background: var(--primary-100);
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */

.gtp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-surface-solid);
    border-top: 1px solid var(--border-strong);
    flex-wrap: wrap;
    gap: var(--space-md);
    border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.gtp-footer-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.gtp-footer-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: right;
}

/* ═══════════════════════════════════════════════════════════════
   DRAFT BANNER
   ═══════════════════════════════════════════════════════════════ */

.gtp-draft-banner {
    background: var(--accent-warning-bg);
    border-left: 4px solid var(--accent-warning);
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.85rem;
    color: var(--text-on-warning-bg);
}

/* ═══════════════════════════════════════════════════════════════
   STATUS MESSAGES + NOTICES
   ═══════════════════════════════════════════════════════════════ */

.gtp-status-success { color: var(--accent-success); }
.gtp-status-error   { color: var(--accent-error); }
.gtp-status-warn    { color: var(--accent-warning); }

.gtp-notice {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border-left: 3px solid;
}

.gtp-notice-success {
    background: var(--accent-success-bg);
    border-color: var(--accent-success);
    color: var(--text-on-success-bg);
}

.gtp-notice-error {
    background: var(--accent-error-bg);
    border-color: var(--accent-error);
    color: var(--text-on-error-bg);
}

.gtp-notice-warn {
    background: var(--accent-warning-bg);
    border-color: var(--accent-warning);
    color: var(--text-on-warning-bg);
}

/* ═══════════════════════════════════════════════════════════════
   SCHULJAHR SWITCHER
   ═══════════════════════════════════════════════════════════════ */

.gtp-sj-btn {
    padding: 4px var(--space-md);
    border-radius: var(--radius-btn);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
}

.gtp-sj-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-on-dark);
}

.gtp-sj-btn-on {
    background: var(--accent-warning);
    border-color: var(--accent-warning);
    color: var(--text-on-warning-btn);
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   THEME SWITCHER
   ═══════════════════════════════════════════════════════════════ */

.gtp-theme-btn, #gtp-theme-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.gtp-theme-btn:hover, #gtp-theme-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-on-dark);
}

.gtp-theme-btn.active, #gtp-theme-btn.gtp-theme-open {
    background: var(--primary-700);
    border-color: var(--primary-700);
    color: var(--text-on-dark);
}

/* Theme-wrap: fixed/absolute container bottom-right */
#gtp-theme-wrap {
    position: absolute;
    bottom: var(--space-md);
    right: var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    z-index: 50;
}

/* Theme panel — hidden by default, shown with .gtp-theme-panel-vis */
#gtp-theme-panel {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-card);
    padding: 6px;
    box-shadow: 0 4px 16px rgba(0, 52, 92, .12);
    min-width: 120px;
}

#gtp-theme-panel.gtp-theme-panel-vis {
    display: flex;
}

.gtp-theme-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}

.gtp-theme-opt:hover {
    background: var(--primary-50);
}

.gtp-theme-opt.gtp-theme-opt-active {
    background: var(--primary-100);
    color: var(--primary-900);
    font-weight: 700;
}

.gtp-theme-opt-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
}

.gtp-theme-opt.gtp-theme-opt-active .gtp-theme-opt-icon {
    color: var(--primary-700);
}

/* ═══════════════════════════════════════════════════════════════
   FEEDBACK BUTTON + MODAL
   ═══════════════════════════════════════════════════════════════ */

.gtp-feedback-btn {
    padding: 5px var(--space-md);
    border-radius: var(--radius-btn);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.gtp-feedback-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-on-dark);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .gtp-tabs {
        padding: var(--space-sm);
        gap: var(--space-xs);
    }

    .gtp-filter-bar {
        padding: var(--space-sm);
        gap: var(--space-xs);
    }

    .gtp-search {
        min-width: 0;
        width: 100%;
    }

    .gtp-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .gtp-footer-meta {
        text-align: left;
    }

    /* Table → Card layout on mobile */
    .gt thead { display: none; }
    .gt,
    .gt tbody,
    .gt tr,
    .gt td { display: block; width: 100%; }

    .gt tr {
        border: 1px solid var(--border-strong);
        border-radius: var(--radius-sm);
        margin-bottom: var(--space-sm);
        padding: var(--space-sm);
        background: var(--bg-surface-solid);
    }

    .gt tr:hover {
        background: var(--primary-100);
    }

    .gt td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        display: block;
        margin-bottom: 2px;
    }

    .gt td {
        border: none;
        padding: 4px 0;
    }

    /* Holiday rows on mobile */
    .gt-hol { border-color: var(--border-strong); }
    .gt-sw { display: none; } /* Schulwochen headers hidden on mobile */
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — INTERMEDIATE (769px – 1200px)
   Table collapses to stacked cards
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 1200px) {
    .gt {
        display: block;
        width: 100%;
    }

    .gt thead { display: none; }
    .gt tbody { display: block; }

    .gt tr {
        display: flex;
        flex-direction: column;
        border: 1px solid var(--border-strong);
        border-radius: var(--radius-card);
        margin-bottom: var(--space-sm);
        padding: var(--space-md);
        background: var(--bg-surface-solid);
        box-shadow: var(--shadow-sm);
        transition: box-shadow var(--transition);
    }

    .gt tr:hover {
        box-shadow: var(--shadow-card);
        background: var(--primary-100);
    }

    .gt td {
        border: none;
        padding: 3px 0;
    }

    .gt-sw tr,
    .gt tr.gt-sw {
        background: var(--primary-100);
        border-color: var(--primary-700);
    }
}

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */

:focus-visible {
    outline: 2px solid var(--primary-700);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    #gtp *,
    #gtp *::before,
    #gtp *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE TOKEN OVERRIDES
   Applied via #gtp[data-gtp-theme="dark"] or
   @media prefers-color-scheme when mode="auto"
   ═══════════════════════════════════════════════════════════════ */

#gtp[data-gtp-theme="dark"] {
    --primary-50:         #0d2035;
    --primary-100:        #172a44;
    --bg-body:            #0f172a;
    --bg-surface-solid:   #1e293b;
    --border-strong:      #334155;
    --border-subtle:      rgba(255, 255, 255, 0.06);
    --text-main:          #e2e8f0;
    --text-muted:         #94a3b8;
    --text-on-dark:       #f1f5f9;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    #gtp[data-gtp-theme="auto"] {
        --primary-50:         #0d2035;
        --primary-100:        #172a44;
        --bg-body:            #0f172a;
        --bg-surface-solid:   #1e293b;
        --border-strong:      #334155;
        --border-subtle:      rgba(255, 255, 255, 0.06);
        --text-main:          #e2e8f0;
        --text-muted:         #94a3b8;
        --text-on-dark:       #f1f5f9;
        color-scheme: dark;
    }
}
