/**
 * TeacherAI Platform Core CSS
 * Architecture V2.0 - Universal Sidebar Template
 * 
 * Updated by Claude 148 - Draggable Resize Feature
 * - Switched from CSS Grid to Flexbox for Split.js compatibility
 * - Added resize gutter (drag handle) styles
 * - Maintains collapse functionality
 * - LocalStorage persistence for user-preferred widths
 * 
 * Tailwind-based utility classes for three-pane layout
 * Mobile-first responsive design
 */

/* ============================================
   PLATFORM WRAPPER
   ============================================ */
.platform-wrapper {
    min-height: 100vh;
    background-color: #f9fafb; /* gray-50 */
}

/* ============================================
   MOBILE HEADER (Hamburger Menu)
   ============================================ */
.platform-mobile-header {
    display: none; /* Hidden on desktop */
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb; /* gray-200 */
    position: sticky;
    top: 0;
    z-index: 40;
}

.platform-mobile-title {
    font-weight: 600;
    font-size: 1.125rem; /* text-lg */
    color: #111827; /* gray-900 */
}

.platform-hamburger {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger-line {
    width: 1.5rem;
    height: 2px;
    background-color: #374151; /* gray-700 */
    transition: all 0.3s ease;
}

/* Hamburger animation when open */
.platform-hamburger.open .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translateY(7px);
}

.platform-hamburger.open .hamburger-line:nth-child(2) {
    opacity: 0;
}

.platform-hamburger.open .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translateY(-7px);
}

/* ============================================
   MAIN FLEX CONTAINER (Split.js Compatible)
   ============================================ */
.platform-grid {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    background-color: #ffffff;
}

/* ============================================
   SIDEBAR SHARED STYLES
   ============================================ */
.platform-sidebar {
    background-color: #ffffff;
    border-color: #e5e7eb; /* gray-200 */
    overflow-y: auto;
    overflow-x: hidden;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    /* Width controlled by Split.js */
}

.platform-sidebar-left {
    border-right: 1px solid #e5e7eb;
    min-width: 48px; /* Collapsed width */
    max-width: 400px;
}

.platform-sidebar-right {
    border-left: 1px solid #e5e7eb;
    min-width: 48px; /* Collapsed width */
    max-width: 400px;
}

/* Collapsed state */
.platform-sidebar.collapsed {
    overflow: hidden;
    min-width: 48px !important;
    max-width: 48px !important;
    width: 48px !important;
    flex-basis: 48px !important;
}

.platform-sidebar.collapsed .sidebar-content,
.platform-sidebar.collapsed .sidebar-header,
.platform-sidebar.collapsed .sidebar-footer {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Toggle button styling */
.sidebar-toggle {
    position: absolute;
    top: 0.75rem;
    width: 1.75rem;
    height: 1.75rem;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: #6b7280;
    transition: all 0.2s;
    z-index: 10;
}

/* Left sidebar toggle - positioned on right edge */
.platform-sidebar-left .sidebar-toggle {
    right: 0.5rem;
}

/* Right sidebar toggle - positioned on left edge */
.platform-sidebar-right .sidebar-toggle {
    left: 0.5rem;
}

.sidebar-toggle:hover {
    background-color: #e5e7eb;
    color: #374151;
}

/* When collapsed, center the toggle button */
.platform-sidebar.collapsed .sidebar-toggle {
    left: 50%;
    transform: translateX(-50%);
    right: auto;
}

/* Sidebar Internal Structure */
.sidebar-header {
    padding: 1rem 1rem 0.5rem 1rem;
    padding-top: 2.5rem; /* Space for toggle button */
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 1.125rem;
    color: #111827;
}

.sidebar-content {
    padding: 0.5rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}

/* ============================================
   SPLIT.JS GUTTER (Drag Handle)
   ============================================ */
.gutter {
    background-color: #f3f4f6;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}

.gutter:hover {
    background-color: #e5e7eb;
}

.gutter:active,
.gutter.dragging {
    background-color: #d1d5db;
}

.gutter.gutter-horizontal {
    width: 6px;
    cursor: col-resize;
}

/* Gutter hover indicator line */
.gutter.gutter-horizontal::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background-color: #9ca3af;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.gutter.gutter-horizontal:hover::after,
.gutter.gutter-horizontal.dragging::after {
    opacity: 1;
}

/* Hide gutter next to collapsed sidebar */
.gutter.gutter-hidden {
    display: none !important;
}

/* ============================================
   CENTER CONTENT PANE
   ============================================ */
.platform-content-pane {
    background-color: #ffffff;
    overflow-y: auto;
    min-height: 100vh;
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 300px; /* Minimum center width */
}

.content-wrapper {
    max-width: none;
    padding: 2rem;
}

/* ============================================
   MOBILE OVERLAY
   ============================================ */
.platform-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 45;
}

.platform-mobile-overlay.active {
    display: block;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .platform-sidebar-left,
    .platform-sidebar-right {
        max-width: 300px;
    }
    
    .content-wrapper {
        padding: 1.5rem;
    }
    
    /* Slightly thinner gutters on tablet */
    .gutter.gutter-horizontal {
        width: 5px;
    }
}

/* Mobile (<768px) */
@media (max-width: 768px) {
    /* Show mobile header */
    .platform-mobile-header {
        display: flex;
    }
    
    /* Stack vertically on mobile */
    .platform-grid {
        flex-direction: column;
    }
    
    /* Hide gutters on mobile */
    .gutter {
        display: none !important;
    }
    
    /* Left sidebar becomes overlay */
    .platform-sidebar-left {
        position: fixed;
        left: 0;
        top: 0;
        width: 80% !important;
        max-width: 320px !important;
        height: 100vh;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
    
    .platform-sidebar-left.open {
        transform: translateX(0);
    }
    
    /* Hide toggle buttons on mobile */
    .sidebar-toggle {
        display: none;
    }
    
    /* Right sidebar - flows naturally below content on mobile */
    .platform-sidebar-right {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        border-left: none;
        border-top: 2px solid #e5e7eb;
        box-shadow: none;
        padding: 1.5rem;
        background-color: #f9fafb;
    }
    
    /* Content pane adjustments */
    .platform-content-pane {
        min-width: 100%;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
}

/* ============================================
   PRINT STYLES (Hide Sidebars)
   ============================================ */
@media print {
    .platform-sidebar-left,
    .platform-sidebar-right,
    .platform-mobile-header,
    .platform-mobile-overlay,
    .sidebar-toggle,
    .gutter {
        display: none !important;
    }
    
    .platform-grid {
        display: block;
    }
    
    .platform-content-pane {
        width: 100% !important;
    }
    
    .content-wrapper {
        max-width: 100%;
        padding: 0;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Button Styles */
.btn-primary {
    background-color: #4f46e5; /* indigo-600 */
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #4338ca; /* indigo-700 */
}

.btn-secondary {
    background-color: #ffffff;
    color: #374151; /* gray-700 */
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: 2px solid #d1d5db; /* gray-300 */
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #f9fafb; /* gray-50 */
}

.btn-danger {
    background-color: #dc2626; /* red-600 */
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-danger:hover {
    background-color: #b91c1c; /* red-700 */
}

/* Card Styles */
.platform-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

.platform-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-blue {
    background-color: #dbeafe; /* blue-100 */
    color: #1e40af; /* blue-800 */
}

.badge-green {
    background-color: #dcfce7; /* green-100 */
    color: #166534; /* green-800 */
}

.badge-purple {
    background-color: #f3e8ff; /* purple-100 */
    color: #6b21a8; /* purple-800 */
}

/* Divider */
.platform-divider {
    border-top: 1px solid #e5e7eb;
    margin: 1.5rem 0;
}
