 /* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

/* Container */
.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.vocab-info {
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 14px;
}

/* Connection Status */
.connection-status {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.1);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.status-indicator {
    font-size: 8px;
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    color: #666;
}

.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Offline Indicator */
.offline-indicator {
    background: #ff6b6b;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Instructions */
.instructions {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    border-radius: 10px;
    margin: 20px;
    text-align: center;
}

/* Difficulty Selector */
.difficulty-selector {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 2px solid #e9ecef;
}

.difficulty-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.difficulty-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
}

.difficulty-btn.easy {
    background: #28a745;
    color: white;
}

.difficulty-btn.medium {
    background: #ffc107;
    color: #333;
}

.difficulty-btn.hard {
    background: #dc3545;
    color: white;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.difficulty-btn.active {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.word-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grammar-hint {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin: 10px 0;
    border-radius: 5px;
    font-style: italic;
}

/* Score Display - Enhanced */
.score-display {
    text-align: center;
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.score-display h4 {
    color: #495057;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score {
    font-size: 32px;
    font-weight: bold;
    color: #007bff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 8px;
}

.session-stats {
    color: #6c757d;
    font-size: 12px;
}

/* Main Content */
.main-content {
    display: flex;
    padding: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

/* Word Bank - Enhanced */
.word-bank {
    flex: 1;
    min-width: 300px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    max-height: 600px;
    overflow-y: auto;
}

.word-bank h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.word-bank-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 15px;
}

.word-category {
    margin-bottom: 20px;
}

.category-title {
    font-weight: bold;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.category-title.nouns { background: #ffc1cc; color: #8b0000; }
.category-title.verbs { background: #add8e6; color: #000080; }
.category-title.adjectives { background: #ffd4a3; color: #cc5500; }
.category-title.articles { background: #d4edda; color: #155724; }
.category-title.conjunctions { background: #e2e3e5; color: #383d41; }
.category-title.prepositions { background: #f8d7da; color: #721c24; }
.category-title.adverbs { background: #d1ecf1; color: #0c5460; }

.word-count-badge {
    background: rgba(0,0,0,0.2);
    color: inherit;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 12px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: rgba(255,255,255,0.5);
}

.word-item {
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    border: 1px solid rgba(0,0,0,0.1);
}

.word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.word-item:active {
    transform: scale(0.95);
}

.word-item.selected {
    background: #007bff !important;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,123,255,0.4);
}

.word-item.noun { background: #ffb3ba; color: #8b0000; }
.word-item.verb { background: #bae1ff; color: #000080; }
.word-item.adjective { background: #ffdfba; color: #cc5500; }
.word-item.article { background: #baffc9; color: #155724; }
.word-item.conjunction { background: #d6d8db; color: #383d41; }
.word-item.preposition { background: #f5c6cb; color: #721c24; }
.word-item.adverb { background: #bee5eb; color: #0c5460; }

/* Sentence Area */
.sentence-area {
    flex: 1.5;
    min-width: 400px;
}

.sentence-template {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    padding: 20px;
    min-height: 200px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.sentence-template h3 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.sample-sentences {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.sample-sentences h4 {
    color: #495057;
    margin-bottom: 12px;
    font-size: 16px;
}

.sample-list {
    margin-bottom: 10px;
}

.sample-item {
    background: white;
    padding: 10px 15px;
    margin: 8px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid #007bff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sample-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.sample-hint {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
    margin: 0;
}

.template-separator {
    text-align: center;
    margin: 20px 0;
    color: #495057;
    font-weight: 600;
}

.building-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    line-height: 1.8;
    padding: 20px;
    background: rgba(248,249,250,0.5);
    border-radius: 10px;
    border: 2px dashed #dee2e6;
    min-height: 80px;
}

.drop-zone {
    min-width: 120px;
    min-height: 50px;
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    font-weight: 500;
}

.drop-zone[data-type="article"] {
    background: #baffc9;
    border-color: #155724;
}

.drop-zone[data-type="adjective"] {
    background: #ffd4a3;
    border-color: #cc5500;
}

.drop-zone[data-type="noun"] {
    background: #ffc1cc;
    border-color: #8b0000;
}

.drop-zone[data-type="verb"] {
    background: #add8e6;
    border-color: #000080;
}

.drop-zone[data-type="adverb"] {
    background: #d1ecf1;
    border-color: #0c5460;
}

.drop-zone[data-type="conjunction"] {
    background: #e2e3e5;
    border-color: #383d41;
}

.drop-zone[data-type="preposition"] {
    background: #f8d7da;
    border-color: #721c24;
}

.drop-zone.filled {
    border-color: #28a745;
    background: #d4edda;
    border-style: solid;
}

.drop-zone.next-to-fill {
    border-color: #007bff;
    background: #e3f2fd;
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 12px rgba(0, 123, 255, 0.4);
    border-style: solid;
}

.drop-zone.next-to-fill[data-type="article"] {
    background: #baffc9;
    border-color: #007bff;
    box-shadow: 0 0 12px rgba(21, 87, 36, 0.4);
}

.drop-zone.next-to-fill[data-type="adjective"] {
    background: #ffd4a3;
    border-color: #007bff;
    box-shadow: 0 0 12px rgba(204, 85, 0, 0.4);
}

.drop-zone.next-to-fill[data-type="noun"] {
    background: #ffc1cc;
    border-color: #007bff;
    box-shadow: 0 0 12px rgba(139, 0, 0, 0.4);
}

.drop-zone.next-to-fill[data-type="verb"] {
    background: #add8e6;
    border-color: #007bff;
    box-shadow: 0 0 12px rgba(0, 0, 128, 0.4);
}

.drop-zone.next-to-fill[data-type="adverb"] {
    background: #d1ecf1;
    border-color: #007bff;
    box-shadow: 0 0 12px rgba(12, 84, 96, 0.4);
}

.drop-zone.next-to-fill[data-type="conjunction"] {
    background: #e2e3e5;
    border-color: #007bff;
    box-shadow: 0 0 12px rgba(56, 61, 65, 0.4);
}

.drop-zone.next-to-fill[data-type="preposition"] {
    background: #f8d7da;
    border-color: #007bff;
    box-shadow: 0 0 12px rgba(114, 28, 36, 0.4);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.drop-zone.auto-filled {
    border-color: #28a745;
    background: #d4edda;
    animation: fillSuccess 0.6s ease-in-out;
}

@keyframes fillSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); background: #c3e6cb; }
    100% { transform: scale(1); }
}

.drop-zone::before {
    content: attr(data-placeholder);
    color: #6c757d;
    font-size: 12px;
    position: absolute;
    top: -22px;
    left: 0;
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.static-word {
    color: #333;
    font-weight: 600;
    font-size: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Controls - Enhanced */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #117a8b);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Feedback - Enhanced */
.feedback {
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    font-weight: 500;
    border: 2px solid;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease-out;
}

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

.feedback.success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-color: #28a745;
    color: #155724;
}

.feedback.error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border-color: #dc3545;
    color: #721c24;
}

.feedback.info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    border-color: #17a2b8;
    color: #0c5460;
}

.feedback.warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-color: #ffc107;
    color: #856404;
}

.feedback h4 {
    margin-bottom: 12px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback ul {
    margin-left: 20px;
    line-height: 1.6;
}

.feedback li {
    margin-bottom: 6px;
}

/* Session Summary */
.session-summary {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    padding: 25px;
    margin: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.session-summary h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 24px;
}

#sessionResults {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

/* Responsive Design - Enhanced */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .main-content {
        flex-direction: column;
        padding: 15px;
    }
    
    .difficulty-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .building-area {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .drop-zone {
        min-width: 100%;
        min-height: 60px;
    }
    
    .word-bank {
        max-height: 350px;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 200px;
    }
    
    .word-bank-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .score {
        font-size: 24px;
    }
    
    .connection-status {
        position: static;
        justify-content: center;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        border-radius: 10px;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.3em;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .sentence-template {
        padding: 15px;
    }
    
    .building-area {
        padding: 15px;
        font-size: 16px;
    }
    
    .drop-zone {
        min-height: 50px;
        font-size: 14px;
    }
    
    .word-item {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .feedback {
        padding: 15px;
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here for future enhancement */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .word-item {
        border: 2px solid currentColor;
    }
    
    .drop-zone {
        border-width: 3px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .header {
        background: #f0f0f0 !important;
        color: black !important;
    }
    
    .controls, .word-bank-controls {
        display: none;
    }
    
    .feedback {
        border: 1px solid #ccc;
        background: #f9f9f9 !important;
        color: black !important;
    }
}
