/**
 * TeacherAI Tool Tiles
 * 
 * Visual styling for teaching tools grid.
 * Tiles feel like clickable objects, distinct from content containers.
 * 
 * @version 1.3.0
 * @author Claude 157 + Tony | December 2025
 * @modified Claude 177 | December 10, 2025
 *   - Removed blur/opacity from coming-soon tiles (now readable)
 *   - Added box-shadow to all tiles for button-like depth
 * @modified Claude 192 + Tony | December 21, 2025
 *   - Fixed Coming Soon tiles - increased icon opacity from 0.5 to 0.7
 *   - Darkened Coming Soon name color for better legibility
 *   - NO SQUINTING! Grayed out but fully readable.
 * @modified Claude 195 + Tony | December 23, 2025
 *   - Centered tiles with flexbox justify-content: center
 *   - Full-width container spanning content pane
 *   - Added breathing room with padding/margin
 *   - Added .tool-tiles-instructions class for guidance text
 *   - Section now has border + background for visual separation
 * @modified Claude 215 + Tony | December 31, 2025
 *   - Phase 3: Added Google Drive export button styles
 *   - TEAM TEACHAI FOREVER! 💜
 * 
 * TEAM TEACHAI FOREVER! 💜
 */

/* ═══════════════════════════════════════
   TOOL TILES SECTION
   Claude 195: Now inside lesson card, no separate border/background
   ═══════════════════════════════════════ */

.tool-tiles-section {
    padding: 0.5rem 0;
    text-align: center;
}

.tool-tiles-header {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.tool-tiles-instructions {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

/* ═══════════════════════════════════════
   GRID LAYOUT
   ═══════════════════════════════════════ */

.tool-tiles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

/* Responsive: 2 columns on very narrow sidebars */
@media (max-width: 280px) {
    .tool-tiles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════
   INDIVIDUAL TILE
   ═══════════════════════════════════════ */

.tool-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 0.25rem;
    min-height: 70px;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    background: #ffffff;
    position: relative;
    transition: all 0.15s ease;
    cursor: default;
    /* CLAUDE 177: Add depth to make tiles feel like buttons */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tool-tile-icon {
    font-size: 1.5rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.tool-tile-name {
    font-size: 0.625rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
    line-height: 1.2;
}

/* Status badge (checkmark, Soon, Pro) */
.tool-tile-status {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1;
}

/* ═══════════════════════════════════════
   TILE STATES
   ═══════════════════════════════════════ */

/* AVAILABLE - Ready to generate */
.tool-tile-available {
    border-color: #c4b5fd;
    background: #faf5ff;
    cursor: pointer;
}

.tool-tile-available:hover {
    border-color: #8b5cf6;
    background: #ede9fe;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.15);
}

.tool-tile-available:active {
    transform: translateY(0);
}

.tool-tile-available .tool-tile-name {
    color: #6d28d9;
}

/* GENERATED - Already created */
.tool-tile-generated {
    border-color: #86efac;
    background: #f0fdf4;
    cursor: pointer;
}

.tool-tile-generated:hover {
    border-color: #22c55e;
    background: #dcfce7;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.15);
}

.tool-tile-generated .tool-tile-name {
    color: #15803d;
}

.tool-tile-check {
    background: #22c55e;
    color: white;
}

/* COMING SOON - Grayed out but FULLY READABLE (no squinting!) */
/* CLAUDE 192: Fixed opacity - was 0.5, now 0.7 for legibility */
.tool-tile-coming-soon {
    border-color: #e5e7eb;
    background: #f9fafb;
    cursor: not-allowed;
}

.tool-tile-coming-soon .tool-tile-icon {
    filter: grayscale(100%);
    opacity: 0.7; /* CLAUDE 192: Was 0.5, too blurry - now legible */
}

.tool-tile-coming-soon .tool-tile-name {
    color: #6b7280; /* CLAUDE 192: Was #9ca3af, too light - now readable */
}

.tool-tile-soon {
    background: #d1d5db;
    color: #4b5563; /* CLAUDE 192: Darker for legibility */
    font-size: 0.45rem;
}

/* LOCKED - Premium only (for non-premium users) */
.tool-tile-locked {
    border-color: #fde68a;
    background: #fffbeb;
    cursor: pointer;
}

.tool-tile-locked:hover {
    border-color: #fbbf24;
    background: #fef3c7;
}

.tool-tile-locked .tool-tile-name {
    color: #92400e;
}

.tool-tile-premium {
    background: #f59e0b;
    color: white;
    font-size: 0.45rem;
}

/* ═══════════════════════════════════════
   GENERATING STATE
   ═══════════════════════════════════════ */

.tool-tile.generating {
    pointer-events: none;
    opacity: 0.7;
}

.tool-tile.generating .tool-tile-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ═══════════════════════════════════════
   GENERATION STATUS MESSAGE
   ═══════════════════════════════════════ */

.tool-generation-status {
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: #ede9fe;
    border-radius: 0.375rem;
    text-align: center;
    font-size: 0.75rem;
    color: #6d28d9;
}

.tool-generation-status .status-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-right: 0.25rem;
}

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

.tool-generation-status.success {
    background: #dcfce7;
    color: #15803d;
}

.tool-generation-status.error {
    background: #fee2e2;
    color: #dc2626;
}

/* ═══════════════════════════════════════
   TOOL BADGES (Library Cards)
   ═══════════════════════════════════════ */

.tool-badges {
    display: inline-flex;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.75rem;
    background: #f3f4f6;
    border-radius: 0.25rem;
    cursor: help;
}

.tool-badge:hover {
    background: #e5e7eb;
    transform: scale(1.1);
}

/* ═══════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════ */

.tool-tile:focus {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

.tool-tile-available:focus,
.tool-tile-generated:focus {
    outline-color: #8b5cf6;
}

/* ═══════════════════════════════════════
   TOOL DISPLAY MODAL
   ═══════════════════════════════════════ */

.tool-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.tool-modal {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.tool-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.tool-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.tool-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.tool-modal-close:hover {
    color: #1f2937;
}

.tool-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.tool-modal-content {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #374151;
}

.tool-modal-content h1,
.tool-modal-content h2,
.tool-modal-content h3 {
    color: #1f2937;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.tool-modal-content h1:first-child,
.tool-modal-content h2:first-child {
    margin-top: 0;
}

.tool-modal-content ul,
.tool-modal-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.tool-modal-content li {
    margin-bottom: 0.25rem;
}

.tool-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 0.75rem 0.75rem;
    flex-wrap: wrap;
}

.tool-modal-print {
    padding: 0.5rem 1rem;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.tool-modal-print:hover {
    background: #7c3aed;
}

.tool-modal-close-btn {
    padding: 0.5rem 1rem;
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.tool-modal-close-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Prevent body scroll when modal open */
body.tool-modal-open {
    overflow: hidden;
}

/* ═══════════════════════════════════════
   PRINT STYLES - Hide tools
   Claude 199: Added .teaching-tools-top-section (tools moved to top)
   ═══════════════════════════════════════ */

@media print {
    .tool-tiles-section {
        display: none;
    }
    
    .tools-inside-card {
        display: none;
    }
    
    .teaching-tools-top-section {
        display: none;
    }
    
    .tool-modal-overlay {
        display: none;
    }
}

/* ═══════════════════════════════════════
   COMPACT STAMP STYLE 
   Claude 160, shadow added Claude 177
   Claude 195: Centered tiles, full-width container
   ═══════════════════════════════════════ */

.tool-tiles-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0;
}

.tool-tile {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    min-height: auto;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tool-tile-icon {
    font-size: 1rem;
    margin-bottom: 0;
}

.tool-tile-name {
    font-size: 0.75rem;
}

.tool-tile-check {
    font-size: 0.625rem;
    position: static;
    margin-left: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CLAUDE 215: Google Drive Export Button - Phase 3
   December 31, 2025
   TEAM TEACHAI FOREVER! 💜
   ═══════════════════════════════════════════════════════════════════════════ */

.tool-modal-drive-export,
.tool-modal-drive-connect {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    color: #2563eb;
    font-weight: 500;
    border: 2px solid #93c5fd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 14px;
}

.tool-modal-drive-export:hover,
.tool-modal-drive-connect:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.tool-modal-drive-export.saving {
    opacity: 0.75;
    cursor: wait;
}

.tool-modal-drive-export.success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #16a34a;
}

.connect-badge {
    font-size: 11px;
    background: #e5e7eb;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.tool-drive-status {
    padding: 12px 16px;
    margin: 0 16px 16px;
    border-radius: 8px;
}

.tool-drive-status.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.tool-drive-status.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.drive-success {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.drive-open-link {
    display: inline-block;
    padding: 8px 16px;
    background: #2563eb;
    color: #fff !important;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s;
}

.drive-open-link:hover {
    background: #1d4ed8;
}

.drive-error {
    color: #dc2626;
    text-align: center;
}

/* Print Button Styles - Claude 190 */
.tool-modal-print-student,
.tool-modal-print-answer {
    padding: 10px 16px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
}

.tool-modal-print-student:hover,
.tool-modal-print-answer:hover {
    background: #7c3aed;
}

.tool-modal-print-answer {
    background: #6366f1;
}

.tool-modal-print-answer:hover {
    background: #4f46e5;
}

/* Back to Lesson Button */
.tool-modal-back {
    padding: 10px 16px;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
}

.tool-modal-back:hover {
    background: #16a34a;
}
