/* mobile.css - Responsive Layouts for Tablets and Phones */

/* Mobile-only elements hidden on desktop */
.mobile-only { display: none !important; }
.mobile-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 992px) {
    /* Show mobile-specific buttons */
    .mobile-only { display: flex !important; }

    /* Compact the top navigation */
    #tactics-pro-app .main-nav {
        padding: 0 10px;
        height: 54px;
    }
    #tactics-pro-app .nav-logo { font-size: 1rem; }
    #tactics-pro-app .nav-btn { padding: 0 8px; font-size: 0.8rem; height: 54px; }
    #tactics-pro-app .history-controls { display: none; } /* Hide undo/redo to save space, rely on tools panel */
    #tactics-pro-app .nav-actions .btn { padding: 6px 10px; font-size: 0.75rem; }

    /* Maximize the Canvas */
    #tactics-pro-app .playmaker-layout {
        position: relative;
        display: flex;
        flex-direction: column;
    }
    #tactics-pro-app .field-container {
        flex: 1;
        height: calc(100vh - 54px - 60px); /* 100vh - nav - timeline */
        width: 100%;
    }
    #tactics-pro-app .canvas-wrapper {
        padding: 10px;
    }

    /* Compact Timeline */
    #tactics-pro-app .timeline-bar {
        height: 60px;
        padding: 0 10px;
        gap: 10px;
    }
    #tactics-pro-app .timeline-actions .btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    #tactics-pro-app .timeline-actions label {
        display: none !important; /* Hide "Keep Lines" text on mobile to save space */
    }

    /* --- OFF-CANVAS SIDEBARS --- */
    #tactics-pro-app .toolbar-wing {
        position: fixed;
        top: 0;
        height: 100%;
        width: 85%;
        max-width: 320px;
        z-index: 999;
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        box-shadow: 0 0 20px rgba(0,0,0,0.5);
        padding-top: 20px;
    }

    /* Left Wing (Tools) slides in from Left */
    #tactics-pro-app .left-wing {
        left: 0;
        transform: translateX(-100%);
        border-right: 1px solid var(--tp-border);
    }
    #tactics-pro-app .left-wing.panel-open {
        transform: translateX(0);
    }

    /* Right Wing (Context) slides in from Right */
    #tactics-pro-app .right-wing {
        right: 0;
        transform: translateX(100%);
        border-left: 1px solid var(--tp-border);
        display: flex !important; /* Override any desktop hiding */
    }
    #tactics-pro-app .right-wing.panel-open {
        transform: translateX(0);
    }

    /* Mobile Close Buttons inside panels */
    .mobile-close-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        background: var(--tp-bg-accent);
        border: 1px solid var(--tp-border);
        color: white;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        cursor: pointer;
        z-index: 10;
    }

    /* Adjust Draggables Grid for Mobile Panel */
    #tactics-pro-app .tool-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    #tactics-pro-app .draggable-tool {
        padding: 8px 4px;
    }
    #tactics-pro-app .icon {
        width: 28px; height: 28px;
    }

    /* --- USER GUIDE MOBILE --- */
    #tactics-pro-app .tp-guide-layout { 
        flex-direction: column; 
        gap: 20px;
    }
    #tactics-pro-app .tp-guide-nav { 
        width: 100%; 
        position: static; 
        padding: 0;
    }
    #tactics-pro-app .tp-guide-nav ul {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 10px;
    }
    #tactics-pro-app .tp-guide-nav li {
        margin-bottom: 0;
        white-space: nowrap;
    }
    #tactics-pro-app .tp-guide-nav a {
        background: var(--tp-bg-panel);
        border: 1px solid var(--tp-border);
    }
    #tactics-pro-app .tp-guide-content {
        padding: 25px 20px;
    }
    #tactics-pro-app .tp-guide-header h1 {
        font-size: 1.6rem;
    }
    #tactics-pro-app .tp-guide-section h2 {
        font-size: 1.3rem;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    #tactics-pro-app .nav-logo span { display: none; }
    #tactics-pro-app .nav-btn { font-size: 0.7rem; padding: 0 5px; }
}
