/* Equi-Pass v3 – Unified Design */
:root {
    --eqp-dark:     #1a1a2e;
    --eqp-darker:   #0f0f1a;
    --eqp-mid:      #16213e;
    --eqp-accent:   #c9a84c;
    --eqp-accent2:  #e8c97e;
    --eqp-green:    #2ecc71;
    --eqp-red:      #e74c3c;
    --eqp-blue:     #3498db;
    --eqp-yellow:   #f1c40f;
    --eqp-text:     #e8e6e0;
    --eqp-muted:    #8a8a9a;
    --sidebar-w:   265px;
    --topbar-h:    62px;
    --radius:      12px;
    --shadow:      0 4px 24px rgba(0,0,0,.28);
    /* role theming */
    --role-color:  var(--eqp-accent);
}
.role-student {
    --role-color: var(--eqp-green);
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'DM Sans', sans-serif; background: var(--eqp-darker); color: var(--eqp-text); margin: 0; min-height: 100vh; }
h1, h2, h3, h4 { font-family: 'Playfair Display', serif; }
a { color: var(--role-color); }
a:hover { color: var(--eqp-accent2); }

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); height: 100vh;
    background: var(--eqp-dark);
    border-right: 1px solid rgba(255,255,255,.06);
    display: flex; flex-direction: column;
    z-index: 1000; overflow-y: auto;
    transition: transform .3s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.05);
    flex-shrink: 0;
}
.brand-icon {
    width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--role-color), var(--eqp-accent2));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: var(--eqp-dark);
}
.brand-name  { font-family:'Playfair Display',serif; font-size: 1.2rem; color: var(--role-color); line-height: 1.1; }
.brand-tenant { font-size: .7rem; color: var(--eqp-muted); margin-top: 1px; }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; margin: 8px 10px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 10px; flex-shrink: 0;
}
.sidebar-avatar { font-size: 1.8rem; color: var(--role-color); line-height: 1; }
.sidebar-username { font-size: .85rem; font-weight: 600; color: var(--eqp-text); }
.role-pill {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: .67rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .8px; padding: 2px 8px; border-radius: 10px;
    margin-top: 3px;
}
.role-pill.admin   { background: rgba(201,168,76,.15); color: var(--eqp-accent); border: 1px solid rgba(201,168,76,.25); }
.role-pill.student { background: rgba(46,204,113,.12); color: var(--eqp-green);  border: 1px solid rgba(46,204,113,.2); }

.sidebar-nav { padding: 8px 0 16px; flex: 1; }
.nav-section-label {
    font-size: .62rem; text-transform: uppercase; letter-spacing: 2px;
    color: var(--eqp-muted); padding: 14px 18px 5px; font-weight: 600;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 16px; margin: 1px 8px; border-radius: 8px;
    color: var(--eqp-muted); text-decoration: none;
    font-size: .9rem; font-weight: 500;
    transition: all .18s; position: relative;
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 18px; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { color: var(--eqp-text); background: rgba(255,255,255,.05); }
.sidebar-nav .nav-link.active {
    color: var(--role-color);
    background: rgba(255,255,255,.07);
    border-left: 3px solid var(--role-color);
    padding-left: 13px;
}
.sidebar-nav .nav-link-danger { color: rgba(231,76,60,.7); }
.sidebar-nav .nav-link-danger:hover { color: var(--eqp-red); background: rgba(231,76,60,.08); }
.nav-badge {
    margin-left: auto; background: var(--eqp-red);
    color: #fff; border-radius: 10px; padding: 1px 7px;
    font-size: .68rem; font-weight: 700;
}

/* ── TOPBAR ───────────────────────────────────── */
.topbar {
    position: sticky; top: 0; height: var(--topbar-h);
    background: rgba(26,26,46,.95); backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px; z-index: 100;
}
.topbar-title { font-family:'Playfair Display',serif; font-size: 1.05rem; flex: 1; }
.topbar-user-badge {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    padding: 5px 14px; border-radius: 20px;
    font-size: .82rem; font-weight: 500; white-space: nowrap;
}
.sidebar-toggle {
    background: none; border: none; color: var(--eqp-text);
    cursor: pointer; padding: 4px 6px; border-radius: 6px;
    transition: background .15s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.08); }

/* ── LAYOUT ───────────────────────────────────── */
.main-wrapper { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left .3s; }
.content-area { padding: 26px 28px; max-width: 1400px; }

/* ── CARDS ─────────────────────────────────────── */
.eqp-card {
    background: var(--eqp-dark);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: var(--radius); padding: 22px;
    box-shadow: var(--shadow); transition: border-color .2s;
}
.eqp-card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.eqp-card-title { font-size: .95rem; font-weight: 600; margin: 0; }

/* ── STATS ─────────────────────────────────────── */
.stat-card {
    background: var(--eqp-dark); border: 1px solid rgba(255,255,255,.07);
    border-radius: var(--radius); padding: 18px 20px;
    display: flex; align-items: center; gap: 14px;
    transition: all .2s;
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.14); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; flex-shrink: 0;
}
.stat-icon.gold   { background: rgba(201,168,76,.14); color: var(--eqp-accent); }
.stat-icon.green  { background: rgba(46,204,113,.12); color: var(--eqp-green); }
.stat-icon.blue   { background: rgba(52,152,219,.12); color: var(--eqp-blue); }
.stat-icon.red    { background: rgba(231,76,60,.12);  color: var(--eqp-red); }
.stat-icon.yellow { background: rgba(241,196,15,.12); color: var(--eqp-yellow); }
.stat-value { font-size: 1.9rem; font-family:'Playfair Display',serif; font-weight: 700; line-height: 1; }
.stat-label { font-size: .72rem; color: var(--eqp-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .8px; }

/* ── BUTTONS ────────────────────────────────────── */
.btn-ep {
    background: linear-gradient(135deg, var(--role-color), var(--eqp-accent2));
    color: var(--eqp-dark); font-weight: 600; border: none;
    border-radius: 8px; padding: 8px 18px; font-size: .87rem;
    text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; transition: all .18s; white-space: nowrap;
}
.btn-ep:hover { opacity: .88; transform: translateY(-1px); color: var(--eqp-dark); }
.btn-ep-sm { padding: 5px 12px; font-size: .8rem; }

.btn-outline {
    background: transparent; color: var(--eqp-muted);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px; padding: 8px 18px; font-size: .87rem;
    text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; transition: all .18s; white-space: nowrap;
}
.btn-outline:hover { color: var(--eqp-text); border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.04); }
.btn-outline-sm { padding: 5px 12px; font-size: .8rem; }

.btn-danger {
    background: rgba(231,76,60,.15); color: var(--eqp-red);
    border: 1px solid rgba(231,76,60,.3);
    border-radius: 8px; padding: 5px 12px; font-size: .8rem;
    text-decoration: none; display: inline-flex; align-items: center; gap: 5px;
    cursor: pointer; transition: all .18s;
}
.btn-danger:hover { background: rgba(231,76,60,.25); color: var(--eqp-red); }

/* ── TABLES ─────────────────────────────────────── */
.eqp-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.eqp-table th {
    font-size: .68rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--eqp-muted); font-weight: 600;
    padding: 9px 14px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.eqp-table td {
    padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.04);
    font-size: .88rem; vertical-align: middle;
}
.eqp-table tbody tr:hover { background: rgba(255,255,255,.02); }
.eqp-table tbody tr:last-child td { border-bottom: none; }

/* ── FORMS ──────────────────────────────────────── */
.form-control, .form-select {
    background: rgba(255,255,255,.05) !important;
    border: 1px solid rgba(255,255,255,.1) !important;
    color: var(--eqp-text) !important; border-radius: 8px !important;
    transition: border-color .18s, box-shadow .18s;
}
.form-control:focus, .form-select:focus {
    background: rgba(255,255,255,.07) !important;
    border-color: var(--role-color) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--role-color) 15%, transparent) !important;
    color: var(--eqp-text) !important;
}
.form-control::placeholder { color: var(--eqp-muted) !important; }
.form-label { color: var(--eqp-muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 5px; }
.form-select option { background: var(--eqp-dark); color: var(--eqp-text); }
.form-check-input:checked { background-color: var(--role-color) !important; border-color: var(--role-color) !important; }

/* ── BADGES ──────────────────────────────────────── */
.badge-ep { padding: 3px 9px; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-active    { background: rgba(46,204,113,.14);  color: #2ecc71; border: 1px solid rgba(46,204,113,.25); }
.badge-draft     { background: rgba(138,138,154,.12); color: var(--eqp-muted); border: 1px solid rgba(138,138,154,.2); }
.badge-paused    { background: rgba(241,196,15,.12);  color: #f1c40f; border: 1px solid rgba(241,196,15,.2); }
.badge-completed { background: rgba(52,152,219,.12);  color: var(--eqp-blue); border: 1px solid rgba(52,152,219,.2); }
.badge-admin     { background: rgba(201,168,76,.14);  color: var(--eqp-accent); border: 1px solid rgba(201,168,76,.2); }
.badge-student   { background: rgba(46,204,113,.12);  color: #2ecc71; border: 1px solid rgba(46,204,113,.2); }
.badge-low    { background: rgba(46,204,113,.1);  color: #2ecc71; }
.badge-medium { background: rgba(241,196,15,.1);  color: #f1c40f; }
.badge-high   { background: rgba(231,76,60,.1);   color: var(--eqp-red); }

/* ── FLASH ───────────────────────────────────────── */
.flash-msg {
    padding: 11px 16px; border-radius: 9px; margin-bottom: 18px;
    font-size: .88rem; display: flex; align-items: center; gap: 9px;
    animation: slideDown .25s ease;
}
.flash-success { background: rgba(46,204,113,.13); border: 1px solid rgba(46,204,113,.28); color: #2ecc71; }
.flash-error   { background: rgba(231,76,60,.13);  border: 1px solid rgba(231,76,60,.28);  color: var(--eqp-red); }
.flash-info    { background: rgba(52,152,219,.13);  border: 1px solid rgba(52,152,219,.28); color: var(--eqp-blue); }
@keyframes slideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }

/* ── LOGIN ───────────────────────────────────────── */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--eqp-darker);
    background-image: radial-gradient(ellipse at 25% 25%, rgba(201,168,76,.07) 0%, transparent 55%),
                      radial-gradient(ellipse at 75% 75%, rgba(46,204,113,.04) 0%, transparent 55%);
}
.login-box {
    width: 100%; max-width: 420px;
    background: var(--eqp-dark); border: 1px solid rgba(255,255,255,.08);
    border-radius: 20px; padding: 42px 38px;
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .brand-icon { width: 58px; height: 58px; font-size: 1.7rem; margin: 0 auto 10px; }
.login-logo h1 { font-size: 1.9rem; color: var(--eqp-accent); margin: 0; }
.login-logo p  { color: var(--eqp-muted); font-size: .83rem; margin: 4px 0 0; }
.login-hint { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); border-radius: 8px; padding: 12px 14px; font-size: .78rem; color: var(--eqp-muted); margin-top: 20px; }
.login-hint strong { color: var(--eqp-text); }

/* ── HORSE CARDS ─────────────────────────────────── */
.horse-card {
    background: var(--eqp-dark); border: 1px solid rgba(255,255,255,.07);
    border-radius: var(--radius); overflow: hidden;
    text-decoration: none; color: var(--eqp-text); display: block;
    transition: all .22s;
}
.horse-card:hover { border-color: rgba(255,255,255,.18); transform: translateY(-3px); box-shadow: var(--shadow); color: var(--eqp-text); }
.horse-card-img {
    height: 160px;
    background: linear-gradient(135deg, rgba(201,168,76,.08), rgba(26,26,46,.6));
    display: flex; align-items: center; justify-content: center;
    font-size: 3.2rem; color: rgba(201,168,76,.25);
    overflow: hidden; position: relative;
}
.horse-card-img img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: center;
    display: block;
}
.horse-card-body { padding: 14px 16px; }
.horse-card-name { font-family:'Playfair Display',serif; font-size: 1.05rem; margin-bottom: 3px; }
.horse-card-meta { font-size: .75rem; color: var(--eqp-muted); }

/* ── PLAN / DAYS / ACTIVITIES ───────────────────── */
.plan-day {
    background: rgba(255,255,255,.02); border: 1px solid rgba(255,255,255,.06);
    border-radius: 10px; margin-bottom: 10px; overflow: hidden;
}
.plan-day-header {
    padding: 13px 16px; display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,.02); cursor: pointer; user-select: none;
}
.plan-day-header:hover { background: rgba(255,255,255,.04); }
.plan-day-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .9rem; }
.plan-day-body { padding: 14px 16px; }

.activity-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 11px 13px; background: rgba(255,255,255,.02);
    border-radius: 8px; margin-bottom: 7px;
    border-left: 3px solid var(--role-color);
    transition: all .18s;
}
.activity-item.completed { opacity: .55; border-left-color: var(--eqp-green); }
.activity-title { font-weight: 600; font-size: .9rem; }
.activity-meta  { font-size: .76rem; color: var(--eqp-muted); margin-top: 2px; }

.activity-check {
    width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; cursor: pointer;
    accent-color: var(--eqp-green);
}

/* ── HEALTH ──────────────────────────────────────── */
.health-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.health-dot.vet         { background: var(--eqp-blue); }
.health-dot.dentist     { background: var(--eqp-green); }
.health-dot.vaccination { background: var(--eqp-accent); }
.health-dot.farrier     { background: #9b59b6; }
.health-dot.deworming   { background: #e67e22; }
.health-dot.blood_test  { background: var(--eqp-red); }
.health-dot.other       { background: var(--eqp-muted); }

/* ── MODAL ───────────────────────────────────────── */
.modal-content  { background: var(--eqp-dark) !important; border: 1px solid rgba(255,255,255,.1) !important; border-radius: var(--radius) !important; }
.modal-header   { border-bottom: 1px solid rgba(255,255,255,.07) !important; }
.modal-footer   { border-top: 1px solid rgba(255,255,255,.07) !important; }
.modal-title    { font-family:'Playfair Display',serif; color: var(--role-color); }
.btn-close      { filter: invert(1) opacity(.6); }

/* ── MISC ─────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 1.7rem; margin: 0; }
.divider { height: 1px; background: rgba(255,255,255,.06); margin: 20px 0; }
.text-muted-ep { color: var(--eqp-muted); }
.eqp-empty { text-align: center; padding: 44px 20px; color: var(--eqp-muted); }
.eqp-empty i { font-size: 2.8rem; display: block; margin-bottom: 12px; opacity: .25; }
.readonly-hint { background: rgba(52,152,219,.07); border: 1px solid rgba(52,152,219,.18); border-radius: 8px; padding: 9px 14px; font-size: .8rem; color: var(--eqp-blue); margin-bottom: 18px; }
.progress-bar-ep { background: rgba(255,255,255,.06); border-radius: 20px; height: 7px; overflow: hidden; }
.progress-bar-ep-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--role-color), var(--eqp-green)); transition: width .5s; }

/* ── HORSE DETAIL PHOTO ───────────────────────────── */
.horse-detail-photo {
    width: 100%; height: 200px;
    border-radius: 10px; overflow: hidden;
    background: linear-gradient(135deg, rgba(201,168,76,.08), rgba(26,26,46,.6));
    display: flex; align-items: center; justify-content: center;
    font-size: 4rem; color: rgba(201,168,76,.2);
}
.horse-detail-photo img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: center;
    display: block;
}

/* ── PHOTO UPLOAD ─────────────────────────────────── */
.photo-upload-area {
    border: 2px dashed rgba(255,255,255,.12);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .2s;
    background: rgba(255,255,255,.02);
    overflow: hidden;
}
.photo-upload-area:hover, .photo-upload-area.drag-over {
    border-color: var(--role-color);
    background: color-mix(in srgb, var(--role-color) 5%, transparent);
}
.photo-preview {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: padding .2s;
}

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.5); }
    .main-wrapper { margin-left: 0; }
    .content-area { padding: 14px 14px; }
    .page-header h1 { font-size: 1.3rem; }
}

/* ── KOMMENTARE ──────────────────────────────────── */
.activity-comments-wrap {
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,.05);
    padding-top: 8px;
}
.day-comment-section {
    margin-top: 14px;
    padding: 12px 14px;
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(255,255,255,.05);
    border-radius: 9px;
}
.day-comment-label {
    font-size: .7rem; text-transform: uppercase; letter-spacing: 1px;
    color: var(--eqp-muted); font-weight: 600; margin-bottom: 8px;
}
.comment-thread { display: flex; flex-direction: column; gap: 6px; }

.comment-item {
    padding: 7px 10px; border-radius: 8px;
    border-left: 3px solid transparent;
    font-size: .84rem;
}
.comment-trainer { background: rgba(201,168,76,.07); border-left-color: var(--eqp-accent); }
.comment-student { background: rgba(46,204,113,.06);  border-left-color: var(--eqp-green); }

.comment-header {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 3px;
}
.comment-author { font-weight: 600; font-size: .78rem; display: flex; align-items: center; gap: 4px; }
.comment-time   { font-size: .7rem; color: var(--eqp-muted); margin-left: auto; }
.comment-body   { font-size: .84rem; line-height: 1.45; color: var(--eqp-text); }

.comment-delete-btn {
    background: none; border: none; color: var(--eqp-muted);
    cursor: pointer; padding: 1px 4px; border-radius: 4px;
    font-size: .8rem; line-height: 1; margin-left: 4px;
    transition: color .15s, background .15s;
}
.comment-delete-btn:hover { color: var(--eqp-red); background: rgba(231,76,60,.1); }

.comment-input-row {
    display: flex; gap: 6px; align-items: flex-end; margin-top: 4px;
}
.comment-textarea {
    flex: 1; background: rgba(255,255,255,.04) !important;
    border: 1px solid rgba(255,255,255,.1) !important;
    color: var(--eqp-text) !important;
    border-radius: 8px !important; padding: 6px 10px !important;
    font-size: .83rem !important; resize: none; overflow: hidden;
    transition: border-color .18s;
    min-height: 34px; max-height: 120px;
    font-family: inherit;
}
.comment-textarea:focus {
    outline: none;
    border-color: var(--role-color) !important;
    background: rgba(255,255,255,.06) !important;
}
.comment-textarea::placeholder { color: var(--eqp-muted) !important; }

.comment-submit-btn {
    background: var(--role-color); border: none; color: var(--eqp-dark);
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: .85rem; transition: opacity .15s;
}
.comment-submit-btn:hover   { opacity: .85; }
.comment-submit-btn:disabled { opacity: .4; cursor: not-allowed; }

.day-comment-badge {
    font-size: .72rem; color: var(--eqp-muted);
    display: inline-flex; align-items: center; gap: 3px;
    margin-left: 4px;
}
