/* ===========================
   Tamil Word Web - Styles
   =========================== */

/* Hero Section */
.wordweb-hero {
    margin-top: 80px;
    padding: 3rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.wordweb-hero h1 {
    font-size: 3rem;
    color: white;
    margin-bottom: 1rem;
}

.wordweb-hero .hero-subtitle {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 0.5rem;
}

.wordweb-hero p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Main Section */
.wordweb-main {
    padding: 3rem 0;
    background: var(--bg-light);
}

/* Control Panel */
.control-panel {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.search-section,
.filter-section,
.legend-section {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.search-section h3,
.filter-section h3,
.legend-section h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1.25rem;
}

/* Search Container */
.search-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.word-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-primary);
    transition: border-color var(--transition-fast);
}

.word-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Quick Words */
.quick-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.quick-words .label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.875rem;
}

.word-tag {
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.word-tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Filter Options */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Legend */
.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.legend-node {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #333;
}

.main-node {
    background: var(--primary-color);
    border-color: var(--primary-dark);
}

.synonym-node {
    background: #06a77d;
    border-color: #048864;
}

.antonym-node {
    background: #d62828;
    border-color: #b41f1f;
}

.hypernym-node {
    background: #ffa630;
    border-color: #e08e1d;
}

.hyponym-node {
    background: #667eea;
    border-color: #4c5fd6;
}

.related-node {
    background: #764ba2;
    border-color: #5d3a7f;
}

/* Visualization Container */
.visualization-container {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.graph-canvas {
    width: 100%;
    height: 600px;
    background: 
        linear-gradient(90deg, rgba(0,0,0,0.02) 1px, transparent 1px),
        linear-gradient(rgba(0,0,0,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    position: relative;
}

.initial-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-light);
}

.initial-message .icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.initial-message h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.initial-message p {
    margin-bottom: 0.5rem;
}

/* Graph Controls */
.graph-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.control-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

/* Word Node Styles (for SVG) */
.word-node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.word-node:hover {
    filter: brightness(1.2);
}

.word-node circle {
    stroke-width: 3;
}

.word-node text {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 14px;
    fill: var(--text-dark);
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: central;
}

.word-link {
    stroke: #999;
    stroke-opacity: 0.6;
    stroke-width: 2;
}

.word-link.synonym-link { stroke: #06a77d; }
.word-link.antonym-link { stroke: #d62828; }
.word-link.hypernym-link { stroke: #ffa630; }
.word-link.hyponym-link { stroke: #667eea; }
.word-link.related-link { stroke: #764ba2; }

/* Word Details Panel */
.word-details {
    position: fixed;
    top: 100px;
    right: 2rem;
    width: 350px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 2rem;
    overflow-y: auto;
    z-index: 1001;
    animation: slideInRight 0.3s ease;
}

.word-details.hidden {
    display: none;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.close-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.detail-word {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-right: 2rem;
}

.detail-content {
    font-size: 0.95rem;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h4 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-section ul {
    list-style: none;
    padding-left: 0;
}

.detail-section li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg-light);
    color: var(--text-light);
}

.detail-section li:last-child {
    border-bottom: none;
}

.speak-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-primary);
    margin-top: 0.5rem;
    transition: all var(--transition-fast);
}

.speak-btn:hover {
    background: var(--primary-dark);
}

/* How It Works Section */
.how-it-works {
    padding: 4rem 0;
    background: white;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.step-item {
    text-align: center;
    padding: 2rem;
    border-radius: var(--radius-md);
    background: var(--bg-light);
    transition: all var(--transition-base);
}

.step-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.step-item h3 {
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.step-item p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Features Section */
.wordweb-features {
    padding: 4rem 0;
    background: var(--bg-light);
}

/* Educational Value Section */
.educational-value {
    padding: 4rem 0;
    background: white;
}

.educational-value h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.benefit-card {
    padding: 2rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    transition: all var(--transition-base);
}

.benefit-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.benefit-card h3 {
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.benefit-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.loading::after {
    content: '⏳';
    font-size: 3rem;
    display: block;
    margin-top: 1rem;
    animation: spin 2s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 968px) {
    .control-panel {
        grid-template-columns: 1fr;
    }
    
    .graph-canvas {
        height: 500px;
    }
    
    .word-details {
        width: calc(100% - 2rem);
        right: 1rem;
        left: 1rem;
    }
    
    .wordweb-hero h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .wordweb-hero h1 {
        font-size: 1.75rem;
    }
    
    .wordweb-hero .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .graph-canvas {
        height: 400px;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
    }
    
    .word-details {
        top: 80px;
        max-height: calc(100vh - 100px);
    }
}

@media (max-width: 480px) {
    .quick-words {
        flex-direction: column;
        align-items: stretch;
    }
    
    .word-tag {
        text-align: center;
    }
    
    .graph-controls {
        flex-wrap: wrap;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .control-panel,
    .graph-controls,
    .footer {
        display: none;
    }
    
    .graph-canvas {
        height: auto;
        page-break-inside: avoid;
    }
}
