/* GrundschulPlaner Frontend Styles */
:root {
  --gsp-primary: #2B5797;
  --gsp-primary-dark: #1e3d6b;
  --gsp-accent: #E8A838;
  --gsp-success: #5BA85B;
  --gsp-danger: #DC3545;
  --gsp-bg: #F8FAFC;
  --gsp-card: #FFFFFF;
  --gsp-border: #E2E8F0;
  --gsp-text: #1E293B;
  --gsp-text-light: #64748B;
  --gsp-radius: 8px;
}

/* App Container */
#gsp-app { max-width: 1200px; margin: 0 auto; padding: 20px; min-height: 400px; }

/* Login Required */
.gsp-login-required { display: flex; justify-content: center; align-items: center; min-height: 300px; }
.gsp-login-box { text-align: center; padding: 40px; background: var(--gsp-card); border-radius: var(--gsp-radius); box-shadow: 0 2px 8px rgba(0,0,0,.08); max-width: 400px; }
.gsp-login-icon { margin-bottom: 16px; }
.gsp-login-box h2 { font-size: 20px; color: var(--gsp-text); margin-bottom: 8px; }
.gsp-login-box p { color: var(--gsp-text-light); margin-bottom: 20px; }

/* Buttons */
.gsp-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: all .15s; }
.gsp-btn-primary { background: var(--gsp-primary); color: #fff; border-color: var(--gsp-primary); }
.gsp-btn-primary:hover { background: var(--gsp-primary-dark); }
.gsp-btn-accent { background: var(--gsp-accent); color: #fff; border-color: var(--gsp-accent); }
.gsp-btn-accent:hover { background: #d49630; }
.gsp-btn-success { background: var(--gsp-success); color: #fff; }
.gsp-btn-danger { background: var(--gsp-danger); color: #fff; }
.gsp-btn-outline { background: transparent; color: var(--gsp-primary); border-color: var(--gsp-border); }
.gsp-btn-outline:hover { background: #f1f5f9; border-color: var(--gsp-primary); }
.gsp-btn-sm { padding: 5px 10px; font-size: 12px; }
.gsp-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Cards */
.gsp-card { background: var(--gsp-card); border: 1px solid var(--gsp-border); border-radius: var(--gsp-radius); padding: 20px; margin-bottom: 16px; }
.gsp-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.gsp-card-title { font-size: 16px; font-weight: 600; color: var(--gsp-text); }

/* Forms */
.gsp-form-group { margin-bottom: 14px; }
.gsp-label { display: block; font-size: 13px; font-weight: 500; color: var(--gsp-text); margin-bottom: 4px; }
.gsp-input, .gsp-select, .gsp-textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--gsp-border); border-radius: 6px; font-size: 14px; background: #fff; color: var(--gsp-text); }
.gsp-input:focus, .gsp-select:focus, .gsp-textarea:focus { outline: none; border-color: var(--gsp-primary); box-shadow: 0 0 0 2px rgba(43,87,151,.15); }
.gsp-textarea { min-height: 80px; resize: vertical; }

/* Grid */
.gsp-grid { display: grid; gap: 16px; }
.gsp-grid-2 { grid-template-columns: 1fr 1fr; }
.gsp-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.gsp-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) { .gsp-grid-2, .gsp-grid-3, .gsp-grid-4 { grid-template-columns: 1fr; } }

/* Stats */
.gsp-stat-card { background: var(--gsp-card); border: 1px solid var(--gsp-border); border-radius: var(--gsp-radius); padding: 16px; text-align: center; }
.gsp-stat-value { font-size: 28px; font-weight: 700; color: var(--gsp-primary); }
.gsp-stat-label { font-size: 13px; color: var(--gsp-text-light); margin-top: 4px; }

/* Table */
.gsp-table { width: 100%; border-collapse: collapse; }
.gsp-table th, .gsp-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gsp-border); }
.gsp-table th { background: #f8fafc; font-weight: 600; font-size: 13px; color: var(--gsp-text-light); }
.gsp-table tr:hover { background: #f1f5f9; }

/* Badges */
.gsp-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.gsp-badge-primary { background: rgba(43,87,151,.1); color: var(--gsp-primary); }
.gsp-badge-accent { background: rgba(232,168,56,.15); color: #b07d1a; }
.gsp-badge-success { background: rgba(91,168,91,.1); color: var(--gsp-success); }

/* Toast */
.gsp-toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; z-index: 10000; animation: gsp-slide-in .3s ease; max-width: 350px; }
.gsp-toast-success { background: var(--gsp-success); }
.gsp-toast-error { background: var(--gsp-danger); }
@keyframes gsp-slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Loading */
.gsp-loading { display: flex; justify-content: center; align-items: center; min-height: 200px; }
.gsp-spinner { width: 36px; height: 36px; border: 3px solid var(--gsp-border); border-top-color: var(--gsp-primary); border-radius: 50%; animation: gsp-spin 1s linear infinite; }
@keyframes gsp-spin { to { transform: rotate(360deg); } }

/* Content display */
.gsp-content { white-space: pre-wrap; line-height: 1.6; font-size: 14px; }
.gsp-content h1, .gsp-content h2, .gsp-content h3 { margin-top: 16px; margin-bottom: 8px; }

/* Header */
.gsp-page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.gsp-page-title { font-size: 24px; font-weight: 700; color: var(--gsp-text); }
.gsp-page-desc { font-size: 14px; color: var(--gsp-text-light); margin-top: 4px; }

/* Modal */
.gsp-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; justify-content: center; align-items: center; z-index: 9999; }
.gsp-modal { background: #fff; border-radius: 12px; padding: 24px; max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto; }
.gsp-modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }

/* Suggestion cards */
.gsp-suggestion { cursor: pointer; padding: 12px; border: 1px solid var(--gsp-border); border-radius: 8px; transition: all .15s; }
.gsp-suggestion:hover { border-color: var(--gsp-primary); box-shadow: 0 2px 8px rgba(43,87,151,.1); }
.gsp-suggestion-title { font-weight: 600; font-size: 13px; color: var(--gsp-text); }
.gsp-suggestion-desc { font-size: 12px; color: var(--gsp-text-light); margin-top: 4px; }

/* Tabs */
.gsp-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gsp-border); margin-bottom: 16px; }
.gsp-tab { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: 14px; color: var(--gsp-text-light); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.gsp-tab.active { color: var(--gsp-primary); border-bottom-color: var(--gsp-primary); font-weight: 600; }

/* Quick Actions */
.gsp-quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.gsp-quick-action { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 16px; background: var(--gsp-card); border: 1px solid var(--gsp-border); border-radius: var(--gsp-radius); cursor: pointer; transition: all .15s; text-decoration: none; color: var(--gsp-text); }
.gsp-quick-action:hover { border-color: var(--gsp-primary); box-shadow: 0 2px 8px rgba(43,87,151,.1); transform: translateY(-2px); }
.gsp-quick-action svg { width: 28px; height: 28px; color: var(--gsp-primary); }
.gsp-quick-action span { font-size: 13px; font-weight: 500; }

/* Actions row */
.gsp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }

/* Empty state */
.gsp-empty { text-align: center; padding: 40px 20px; color: var(--gsp-text-light); }
.gsp-empty svg { width: 48px; height: 48px; color: #cbd5e1; margin-bottom: 12px; }

/* Success button */
.gsp-btn-success { background: #5BA85B; color: #fff; border-color: #5BA85B; }
.gsp-btn-success:hover { background: #4a8f4a; border-color: #4a8f4a; }

/* Success badge */
.gsp-badge-success { background: rgba(91,168,91,.1); color: #5BA85B; }

/* Shared indicator */
.gsp-shared-indicator { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #5BA85B; font-weight: 500; }

/* Differentiation tabs */
.gsp-diff-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gsp-border); margin-bottom: 16px; flex-wrap: wrap; }
.gsp-diff-tab { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: 14px; color: var(--gsp-text-light); border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 500; transition: all .15s; }
.gsp-diff-tab:hover { color: var(--gsp-primary); background: #f1f5f9; }
.gsp-diff-tab.active { color: var(--gsp-primary); border-bottom-color: var(--gsp-primary); font-weight: 600; }
.gsp-diff-content { padding: 16px 0; }

/* Parent letter / danger badge */
.gsp-badge-danger { background: rgba(255,107,107,.1); color: #FF6B6B; }

/* Manual page */
.gsp-manual-content { line-height: 1.7; }
.gsp-manual-content h2 { scroll-margin-top: 20px; }
.gsp-manual-content section { page-break-inside: avoid; }
.gsp-manual-toc { background: #f8fafc; border: 1px solid var(--gsp-border); border-radius: 8px; padding: 20px 24px; }
.gsp-manual-toc a { color: var(--gsp-primary); text-decoration: none; }
.gsp-manual-toc a:hover { text-decoration: underline; }

/* Print styles */
@media print {
    .gsp-page-header button, .gsp-page-header .gsp-btn,
    header, footer, nav, .gsp-sidebar, .gsp-quick-actions { display: none !important; }
    .gsp-card { box-shadow: none !important; border: none !important; }
    .gsp-manual-content { padding: 0; }
    body { font-size: 12pt; }
}
