/* ============================================================
   M.I.R.A. Dashboard — Stylesheet
   Dark-mode, glassmorphism, premium feel
   ============================================================ */

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

/* ── Reset & Variables ──────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 30, 55, 0.7);
    --bg-card-hover: rgba(40, 40, 70, 0.8);
    --bg-sidebar: rgba(15, 15, 30, 0.95);
    --bg-tertiary: rgba(20, 20, 40, 0.8);
    --border: rgba(124, 58, 237, 0.15);
    --border-hover: rgba(124, 58, 237, 0.4);

    --purple: #7c3aed;
    --purple-light: #a78bfa;
    --purple-glow: rgba(124, 58, 237, 0.3);
    --green: #22c55e;
    --green-light: #4ade80;
    --red: #ef4444;
    --red-light: #f87171;
    --yellow: #eab308;
    --blue: #3b82f6;
    --cyan: #06b6d4;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Aliases used in inline styles */
    --text-color: var(--text-primary);
    --border-color: var(--border);
    --primary: var(--purple);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

.theme-light {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(248, 250, 252, 0.9);
    --bg-sidebar: rgba(255, 255, 255, 0.95);
    --bg-tertiary: rgba(241, 245, 249, 0.9);
    --border: rgba(124, 58, 237, 0.15);
    --border-hover: rgba(124, 58, 237, 0.4);

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    /* Aliases */
    --text-color: var(--text-primary);
    --border-color: var(--border);
    --primary: var(--purple);
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: 72px;
    height: 100vh;
    max-height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar:hover {
    width: 240px;
}

.sidebar.collapsed {
    /* Only slide off-screen entirely on mobile/tablet if needed, handled in media queries */
}

.sidebar-logo {
    width: 100%;
    flex-shrink: 0;
    padding: 20px 0 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 12px;
}

.sidebar-collapse-btn {
    flex-shrink: 0;
    width: 44px;
    height: 36px;
    margin: 8px 14px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: color var(--transition), background var(--transition);
}

.sidebar-collapse-btn:hover {
    color: var(--purple-light);
    background: var(--purple-glow);
}

.sidebar:hover .sidebar-collapse-btn .collapse-icon-expanded {
    display: inline;
}

.sidebar:hover .sidebar-collapse-btn .collapse-icon-narrow {
    display: none;
}

.sidebar .sidebar-collapse-btn .collapse-icon-expanded {
    display: none;
}

.sidebar .sidebar-collapse-btn .collapse-icon-narrow {
    display: inline;
}

.sidebar-item {
    height: 44px;
    margin: 0 14px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-muted);
    position: relative;
    text-decoration: none;
    overflow: hidden;
}

.sidebar-icon {
    width: 44px;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-label {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 15px;
    font-weight: 500;
}

.sidebar:hover .sidebar-label {
    opacity: 1;
}

.sidebar:hover .tooltip {
    display: none !important;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: var(--purple-glow);
    color: var(--purple-light);
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: -14px;
    width: 3px;
    height: 24px;
    background: var(--purple);
    border-radius: 0 3px 3px 0;
}

.sidebar-item .tooltip {
    position: absolute;
    left: 60px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    color: var(--text-primary);
    z-index: 200;
}

.sidebar-item:hover .tooltip {
    opacity: 1;
}

/* ── Main Content ───────────────────────────────────────── */
.main {
    margin-left: 72px;
    width: calc(100vw - 72px);
    flex: 1;
    padding: 24px 32px;
    min-height: 100vh;
    transition: margin-left var(--transition), width var(--transition);
    overflow-x: hidden;
}

.sidebar.collapsed~.main {
    margin-left: 0;
    width: 100vw;
}

/* ── Page Fill ──────────────────────────────────────────── */
.page {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--purple-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.system-stats,
.topbar-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-card);
    padding: 8px 20px;
    border-radius: 24px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    position: relative;
    cursor: default;
}

.stat-item:not(:last-child)::after {
    content: '';
    display: block;
    width: 1px;
    height: 16px;
    background: var(--border);
    margin-left: 16px;
}

.stat-item .icon {
    font-size: 16px;
    opacity: 0.8;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.hamburger-btn:hover {
    background: var(--bg-card-hover);
}

/* ── Actions Bar ────────────────────────────────────────── */
.actions-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: blur(10px);
}

.btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--purple), #6d28d9);
    border-color: var(--purple);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #8b5cf6, var(--purple));
}

.btn-danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--red-light);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--red);
}

.btn-success {
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--green-light);
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--green);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Widgets (Startseite) ─────────────────────────────────── */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.widget-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}

.widget-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--border-hover);
}

.widget-card h3 {
    margin-bottom: 20px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Container Grid ─────────────────────────────────────── */
.container-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* ── Container Card ─────────────────────────────────────── */
.container-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.container-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--purple);
    opacity: 0;
    transition: opacity var(--transition);
}

.container-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.container-card:hover::before {
    opacity: 1;
}

.container-card.stopped {
    opacity: 0.6;
}

.container-card.stopped:hover {
    opacity: 0.9;
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

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

.card-icon {
    font-size: 24px;
    line-height: 1;
}

.card-name {
    font-size: 16px;
    font-weight: 600;
}

.card-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
}

.status-badge.running {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-badge.exited,
.status-badge.stopped {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-badge.restarting {
    background: rgba(234, 179, 8, 0.1);
    color: var(--yellow);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.running .status-dot {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Card Metrics */
.card-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.metric {
    display: flex;
    align-items: center;
    gap: 10px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    width: 36px;
    flex-shrink: 0;
}

.metric-bar-wrap {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.metric-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    min-width: 2px;
}

.metric-bar.cpu {
    background: linear-gradient(90deg, var(--cyan), var(--purple));
}

.metric-bar.ram {
    background: linear-gradient(90deg, var(--green), var(--yellow));
}

.metric-bar.high {
    background: linear-gradient(90deg, var(--yellow), var(--red)) !important;
}

.metric-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

.card-uptime {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.card-uptime span {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.card-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
}

/* ── Log Modal ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 18px;
    transition: all var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.log-output {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

.log-output .log-line {
    padding: 1px 0;
}

.log-output .log-line:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* ── Settings Page ──────────────────────────────────────── */
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    backdrop-filter: blur(10px);
}

.settings-card h2 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--purple-light);
    box-shadow: 0 0 0 2px var(--purple-glow);
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ── Toast Notifications ────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 280px;
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.4);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
}

@keyframes slideIn {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Loading State ──────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-card) 25%,
            rgba(255, 255, 255, 0.05) 50%,
            var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        width: 56px;
    }

    .main {
        margin-left: 56px;
        padding: 16px;
    }

    .header h1 {
        font-size: 18px;
    }

    .container-grid {
        grid-template-columns: 1fr;
    }

    .system-stats {
        gap: 8px;
    }

    .stat-chip {
        padding: 6px 12px;
        font-size: 12px;
    }

    .modal-overlay {
        padding: 16px;
    }
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--purple);
}

/* ── Login Screen ─────────────────────────────────────── */
.login-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 48px 40px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: loginFadeIn 0.6s ease;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin-bottom: 16px;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--purple-light), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
}

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

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-field .form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.login-field .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.login-error {
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #ef4444;
    font-size: 13px;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--purple), var(--primary));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* User badge in sidebar */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-user:hover {
    background: var(--bg-card-hover);
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ═══════════════ KALENDER ═══════════════ */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.5rem;
}

.cal-day {
    min-height: 70px;
    padding: 0.35rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.cal-day:hover {
    background: var(--bg-secondary);
}

.cal-day.today {
    border: 2px solid var(--primary);
}

.cal-day.empty {
    background: transparent;
    cursor: default;
}

.cal-num {
    font-weight: 600;
    font-size: 0.9rem;
}

.cal-dots {
    display: flex;
    gap: 3px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.cal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

/* ═══════════════ MEDIEN ═══════════════ */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.media-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.media-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.media-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.media-name {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ═══════════════ STATS GRID ═══════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ═══════════════ DEVICE RESPONSIVE ═══════════════ */

/* Phone-Modus: Sidebar wird Overlay, kompaktere Layouts */
.device-phone .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 2000;
    transition: left 0.3s ease;
    width: 260px !important;
}

.device-phone .sidebar.visible {
    left: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.device-phone .dashboard-layout {
    margin-left: 0 !important;
}

.device-phone .calendar-grid {
    gap: 1px;
}

.device-phone .cal-day {
    min-height: 45px;
    font-size: 0.8rem;
    padding: 0.2rem;
}

.device-phone .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

.device-phone .stats-grid {
    grid-template-columns: repeat(2, 1fr);
}

.device-phone .header h1 {
    font-size: 1.1rem;
}

.device-phone .settings-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.device-phone .settings-tabs::-webkit-scrollbar {
    display: none;
}

/* Tablet-Modus: Medium-Layout */
.device-tablet .sidebar {
    width: 60px !important;
}

.device-tablet .sidebar .sidebar-label {
    display: none;
}

.device-tablet .sidebar.expanded {
    width: 260px !important;
}

.device-tablet .sidebar.expanded .sidebar-label {
    display: inline;
}

.device-tablet .calendar-grid {
    gap: 2px;
}

.device-tablet .cal-day {
    min-height: 55px;
}

.device-tablet .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

/* Desktop: breitere Sidebar, Main-Inhalt entsprechend verschieben */
.device-desktop .sidebar {
    width: 260px;
}

.device-desktop .sidebar .sidebar-label {
    opacity: 1;
}

.device-desktop .sidebar.collapsed {
    width: 72px;
}

.device-desktop .sidebar.collapsed .sidebar-label {
    opacity: 0;
}

.device-desktop .sidebar.collapsed:hover {
    width: 260px;
}

.device-desktop .sidebar.collapsed:hover .sidebar-label {
    opacity: 1;
}

.device-desktop .main {
    margin-left: 260px;
    width: calc(100vw - 260px);
}

.device-desktop .sidebar.collapsed~.main {
    margin-left: 72px;
    width: calc(100vw - 72px);
}

/* Android-spezifisch: Safe-Area Insets */
body[data-os="android"] {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

body[data-os="android"].device-phone .header {
    padding-top: env(safe-area-inset-top, 0);
}

/* iOS-spezifisch */
body[data-os="ios"] {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ═══════════════ PRINT / DARK HELPER ═══════════════ */
@media print {

    .sidebar,
    .header,
    .hamburger-btn,
    #page-chat {
        display: none !important;
    }

    .dashboard-layout {
        margin-left: 0 !important;
    }
}

/* Touch-Optimierung */
@media (pointer: coarse) {

    .btn,
    .settings-tab,
    .tools-tab,
    .sidebar-item {
        min-height: 44px;
        min-width: 44px;
    }

    .cal-day {
        min-height: 50px;
    }
}

/* Spinner Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}