/* Squash AI Coach Design System - Minimalist Slate */
:root {
    --bg-color: #12131a; /* Bardzo ciemny matowy szary */
    --card-bg: #1c1d24; /* Płaskie, solidne karty */
    --card-border: rgba(255, 255, 255, 0.05);
    --text-primary: #f3f4f6; /* Jasnoszary / off-white */
    --text-secondary: #9ca3af; /* Stłumiony szary */
    --accent-color: #f97316; /* Jaskrawy pomarańczowy */
    --accent-gradient: linear-gradient(135deg, #f97316 0%, #ffaa66 100%);
    --success-color: #10b981;
    --danger-color: #ef4444;
    --font-outfit: 'Outfit', sans-serif;
    --font-inter: 'Inter', sans-serif;
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    overflow-x: hidden;
}

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

/* Subtelna poświata w tle */
.background-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.06) 0%, rgba(0,0,0,0) 70%);
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.5));
}

.logo-icon-img {
    height: 2.25rem;
    width: 2.25rem;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.4));
}

h1 {
    font-family: var(--font-outfit);
    font-weight: 800;
    font-size: 1.75rem;
    letter-spacing: -0.03em;
}

.accent-text {
    color: var(--accent-color);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status Badge */
.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
}

.status-badge.connected {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}
.status-badge.connected .status-dot {
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.status-badge.disconnected {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}
.status-badge.disconnected .status-dot {
    background-color: var(--danger-color);
    box-shadow: 0 0 8px var(--danger-color);
}

/* Cards (Minimalist Slate) */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-family: var(--font-outfit);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1.2fr 1fr;
    }
}

/* Video Preview Container */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recording-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(239, 68, 68, 0.85);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.record-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #fff;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* Buttons */
.btn {
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-color);
    color: #fff;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.25);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
    filter: brightness(1.1);
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    filter: brightness(1.1);
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none !important;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-select {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: var(--font-inter);
    outline: none;
    cursor: pointer;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Status Message */
.status-log-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.status-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* AI Feedback display styles */
.feedback-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Coach Chat Feed */
.coach-chat-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.coach-chat-feed::-webkit-scrollbar {
    width: 6px;
}
.coach-chat-feed::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}
.coach-chat-feed::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.coach-bubble {
    display: flex;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    animation: slideInBottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform-origin: bottom;
}

.coach-bubble.intro {
    background: rgba(249, 115, 22, 0.05);
    border-color: rgba(249, 115, 22, 0.2);
}

.coach-avatar {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.coach-avatar-img {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.bubble-content {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.bubble-content strong {
    color: var(--accent-color);
    font-family: var(--font-outfit);
    margin-right: 0.25rem;
}

.player-target {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Tip Metadata Badges */
.tip-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.tip-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    font-family: var(--font-outfit);
}

.tip-badge-category {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.2);
    color: var(--accent-color);
}

/* Severity-specific badge styles */
.tip-badge.severity-minor {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

.tip-badge.severity-moderate {
    background: rgba(250, 204, 21, 0.08);
    border-color: rgba(250, 204, 21, 0.25);
    color: #fde68a;
}

.tip-badge.severity-critical {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

/* Severity-based bubble left border accent */
.coach-bubble.severity-minor {
    border-left: 3px solid rgba(16, 185, 129, 0.5);
}

.coach-bubble.severity-moderate {
    border-left: 3px solid rgba(250, 204, 21, 0.5);
}

.coach-bubble.severity-critical {
    border-left: 3px solid rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.03);
}

.tip-main-text {
    line-height: 1.55;
}

/* Drill Suggestion Accordion */
.drill-accordion {
    margin-top: 0.6rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.drill-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-outfit);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.drill-toggle:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.drill-toggle-icon {
    font-size: 0.95rem;
}

.drill-toggle-label {
    flex: 1;
    text-align: left;
}

.drill-toggle-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.drill-accordion.open .drill-toggle-arrow {
    transform: rotate(90deg);
}

.drill-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 0 0.75rem;
}

.drill-accordion.open .drill-content {
    max-height: 200px;
    padding: 0 0.75rem 0.65rem;
}


/* Settings Footer */
.footer-settings {
    margin-top: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .footer-settings {
        flex-direction: row;
        justify-content: space-between;
    }
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.settings-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-text {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-text:focus {
    border-color: var(--accent-color);
}

.session-input-row {
    display: flex;
    gap: 0.5rem;
}

.session-input-row .input-text {
    flex: 1;
    font-family: monospace;
    letter-spacing: 0.05em;
    background: rgba(15, 23, 42, 0.8);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

/* Modal Konfiguracji Graczy */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: -1rem;
}

.players-forms-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .players-forms-container {
        grid-template-columns: 1fr 1fr;
    }
}

.player-config-box {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.player-config-box h3 {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

/* Warning Banner */
.warning-banner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

@media (min-width: 640px) {
    .warning-banner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.warning-banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.warning-banner-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.warning-banner-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

#btn-configure-backend-shortcut {
    align-self: flex-start;
    border-color: rgba(249, 115, 22, 0.4);
    color: var(--accent-color);
}

#btn-configure-backend-shortcut:hover {
    background: rgba(249, 115, 22, 0.1);
}

@media (min-width: 640px) {
    #btn-configure-backend-shortcut {
        align-self: auto;
    }
}

/* Icon Buttons */
.btn-icon-only {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.btn-icon-only:hover {
    background-color: rgba(255, 255, 255, 0.08);
}
.btn-icon-only:active {
    transform: scale(0.95);
}

/* Mobile Tabs Navigation */
.mobile-tabs-container {
    display: none;
    grid-template-columns: 1fr 1fr;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.25rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem;
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Settings Drawer styles */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--card-bg);
    border-left: 1px solid var(--card-border);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 1200;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
}

.drawer.active {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h2 {
    font-family: var(--font-outfit);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.drawer-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

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

.drawer-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Drawer Instructions */
.drawer-instructions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overflow-y: auto;
}

.drawer-instructions h3 {
    font-family: var(--font-outfit);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
}

.drawer-instructions p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.drawer-instructions ol {
    padding-left: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.drawer-instructions li {
    line-height: 1.4;
}

.drawer-instructions code {
    display: block;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-top: 0.35rem;
    word-break: break-all;
}

.repo-link-wrapper {
    margin-top: 0.25rem;
}

.repo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.repo-link:hover {
    color: #ff8533;
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .mobile-tabs-container {
        display: grid;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .dashboard-grid .card.mobile-hidden {
        display: none !important;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .btn, .btn-select, .input-text {
        padding: 0.85rem 1.25rem;
        min-height: 48px;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .card-header h2 {
        flex: 1 1 auto;
    }

    .controls-row {
        flex: 1 1 100%;
    }

    .controls-row .btn-select {
        width: 100%;
    }
}
