/**
 * Alpha.css - Indexed Address Book Style Layout
 * Alphabetical word list with sidebar index and main content area
 */

/* Address Book Container */
.address-book-container {
    display: flex;
    gap: 0;
    min-height: 60vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Left Sidebar - Index */
.index-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    border-right: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.index-header {
    padding: 1.5rem;
    border-bottom: 1px solid #cbd5e1;
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
    color: white;
}

.index-title {
    margin: 0 0 1rem 0;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.index-icon {
    font-size: 1.6rem;
}

.index-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-label {
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
}

/* Index Content */
.index-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.character-group {
    border-bottom: 1px solid #e2e8f0;
}

.character-header {
    padding: 1rem 1.5rem;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.character-header:hover {
    background: #f1f5f9;
    border-left-color: #1976d2;
}

.character-letter {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1976d2;
    font-family: 'Kalpurush', 'Noto Sans Assamese', sans-serif;
}

.character-toggle {
    color: #64748b;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.character-header.expanded .character-toggle {
    transform: rotate(180deg);
}

.character-ranges {
    background: #f8fafc;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.character-ranges.expanded {
    max-height: none;
    overflow: visible;
}

.range-item {
    padding: 0.75rem 1.5rem 0.75rem 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.range-item:hover {
    background: #e2e8f0;
    border-left-color: #64b5f6;
}

.range-item.active {
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
    color: white;
    border-left-color: #0d47a1;
}

.range-text {
    font-weight: 600;
    font-family: 'Kalpurush', 'Noto Sans Assamese', sans-serif;
}

.range-count {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 500;
}

/* Right Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Welcome State */
.welcome-state {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem;
    height: 100%;
    min-height: 400px;
}

.welcome-content {
    text-align: center;
    max-width: 500px;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.welcome-title {
    margin: 0 0 1rem 0;
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

.welcome-description {
    margin: 0 0 2rem 0;
    color: #64748b;
    line-height: 1.6;
    font-size: 1.1rem;
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: #475569;
}

.feature-icon {
    font-size: 1.2rem;
}

/* Word Display Section */
.word-display-section {
    padding: 2rem;
    flex: 1;
}

.content-header {
    margin-bottom: 2rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #64748b;
}

.breadcrumb-item.active {
    color: #1976d2;
    font-weight: 600;
}

.breadcrumb-item.clickable {
    cursor: pointer;
    transition: color 0.2s;
}

.breadcrumb-item.clickable:hover {
    color: #1976d2;
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #cbd5e1;
}

.content-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
}

.content-subtitle {
    margin: 0;
    color: #64748b;
    font-size: 1rem;
}

.content-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.action-btn.secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.action-btn.secondary:hover {
    background: #e2e8f0;
    color: #334155;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-left: 4px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin: 0;
    color: #64748b;
    font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 1023px) {
    .address-book-container {
        flex-direction: column;
        gap: 0;
        border-radius: 8px;
    }

    .index-sidebar {
        width: 100%;
        max-height: none;
        min-height: auto;
        border-right: none;
        border-bottom: 2px solid #e2e8f0;
        background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    }

    .index-header {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid #cbd5e1;
    }

    .index-title {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .index-stats {
        flex-direction: row;
        justify-content: space-between;
        gap: 1rem;
    }

    .stat-item {
        flex-direction: column;
        text-align: center;
        gap: 0.25rem;
    }

    .index-content {
        max-height: 60vh;
        overflow-y: auto;
        padding: 0;
    }

    .character-header {
        padding: 0.75rem 1.5rem;
    }

    .character-letter {
        font-size: 1.2rem;
    }

    .character-ranges {
        background: rgba(255, 255, 255, 0.8);
    }

    .range-item {
        padding: 0.75rem 1.5rem;
        margin: 0;
    }

    .content-area {
        width: 100%;
        min-height: 50vh;
    }

    .welcome-state {
        min-height: 300px;
        padding: 2rem 1rem;
    }

    .welcome-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .welcome-description {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .welcome-features {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }

    .feature-item {
        flex: 0 1 calc(50% - 0.375rem);
        min-width: 140px;
        text-align: center;
    }

    .word-display-section {
        padding: 0;
    }

    .content-header {
        padding: 1rem 1.5rem;
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0;
    }

    .breadcrumb {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .content-title {
        font-size: 1.4rem;
        margin-bottom: 0.25rem;
    }

    .content-subtitle {
        font-size: 0.9rem;
    }

    .word-content {
        padding: 1rem 1.5rem;
    }

    .content-actions {
        padding: 1rem 1.5rem;
        background: #f8fafc;
        border-top: 1px solid #e2e8f0;
    }
}

/* Back to top styling */
.back-to-top-container {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem 0;
    border-top: 1px solid rgba(100, 181, 246, 0.2);
    border-bottom: 1px solid rgba(100, 181, 246, 0.2);
}

.back-to-top-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(100, 181, 246, 0.1) 0%, rgba(255, 255, 255, 0.8) 100%);
    border: 1px solid rgba(100, 181, 246, 0.3);
    border-radius: 20px;
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.back-to-top-link:hover {
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
}

/* Character sections in alphabetical index */
.character-section {
    margin-bottom: 1.5rem;
}

.character-section h3 {
    margin-bottom: 0.75rem;
    color: #1976d2;
    border-bottom: 1px solid rgba(100, 181, 246, 0.3);
    padding-bottom: 0.5rem;
}

/* Alphabet link active state */
.alphabet-link.active {
    background: linear-gradient(135deg, #64b5f6 0%, #1976d2 100%);
    color: white;
    border-color: #1976d2;
}

/* Loading indicator */
.loading-indicator {
    text-align: center;
    padding: 1rem;
}

/* Word display styles */
.words-list {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-top: 1rem;
    line-height: 1.4;
}

.word-item {
    padding: 0.75rem 1rem;
    border: none;
    box-shadow: none;
    background: transparent;
    border-bottom: 1px solid rgba(100, 181, 246, 0.15);
    margin-bottom: 0;
}

.word-item:hover {
    transform: none;
    box-shadow: none;
    background: rgba(100, 181, 246, 0.05);
}

.word-header {
    display: inline;
    margin-bottom: 0.5rem;
}

.word-title {
    display: inline;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.word-title a {
    color: #1976d2;
    text-decoration: none;
    font-family: 'Kalpurush', 'Noto Sans Assamese', sans-serif;
}

.word-title a:hover {
    text-decoration: underline;
}

.pos-tag {
    background: none;
    color: #666;
    padding: 0 0.25rem;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 500;
    font-style: italic;
    cursor: help;
}

.edit-link {
    background: none;
    color: #999;
    padding: 0 0.25rem;
    border: none;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: normal;
    transition: color 0.3s ease;
}

.edit-link:hover {
    color: #1976d2;
    background: none;
}

.word-meanings {
    display: inline;
    margin-left: 0.5rem;
}

.meaning-item {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.meaning-item:not(:last-child):after {
    content: "; ";
    color: #666;
    font-weight: 500;
}

.meaning-number {
    background: none;
    color: #666;
    width: auto;
    height: auto;
    border-radius: 0;
    display: inline;
    font-weight: bold;
    font-size: 0.9rem;
    margin-right: 0.25rem;
}

.meaning-text {
    color: #333;
    line-height: 1.4;
    font-size: 1rem;
    font-family: 'Kalpurush', 'Noto Sans Assamese', sans-serif;
    display: inline;
}

.edit-meaning-link {
    background: none;
    color: #999;
    padding: 0 0.25rem;
    border: none;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: normal;
    transition: color 0.3s ease;
    margin-left: 0.25rem;
}

.edit-meaning-link:hover {
    color: #f57c00;
    background: none;
}

.results-summary {
    margin-top: 1.5rem;
    text-align: center;
    padding-top: 1rem;
    border-top: 2px solid rgba(100, 181, 246, 0.2);
}

/* Tablet and smaller screens */
@media (max-width: 768px) {
    .address-book-container {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .index-header {
        padding: 0.75rem 1rem;
    }

    .index-title {
        font-size: 1.1rem;
    }

    .index-stats {
        gap: 0.5rem;
    }

    .stat-item {
        font-size: 0.8rem;
    }

    .character-header {
        padding: 0.625rem 1rem;
    }

    .character-letter {
        font-size: 1.1rem;
    }

    .range-item {
        padding: 0.625rem 1rem;
    }

    .range-text {
        font-size: 0.9rem;
    }

    .range-count {
        font-size: 0.8rem;
    }

    .content-header {
        padding: 0.75rem 1rem;
    }

    .breadcrumb {
        font-size: 0.8rem;
    }

    .content-title {
        font-size: 1.25rem;
    }

    .word-content {
        padding: 0.75rem 1rem;
    }

    .content-actions {
        padding: 0.75rem 1rem;
    }

    .word-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .word-title {
        font-size: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .meaning-item {
        padding: 0.5rem;
    }

    .meaning-text {
        font-size: 1rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .content-sections {
        padding: 0;
        gap: 0;
    }

    .address-book-container {
        border-radius: 0;
    }

    .index-header {
        padding: 0.5rem 0.75rem;
    }

    .index-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .index-stats {
        flex-direction: column;
        gap: 0.25rem;
    }

    .stat-item {
        flex-direction: row;
        justify-content: space-between;
        font-size: 0.75rem;
    }

    .index-content {
        max-height: 50vh;
    }

    .character-header {
        padding: 0.5rem 0.75rem;
    }

    .character-letter {
        font-size: 1rem;
    }

    .range-item {
        padding: 0.5rem 0.75rem;
    }

    .range-text {
        font-size: 0.85rem;
    }

    .range-count {
        font-size: 0.75rem;
    }

    .welcome-state {
        padding: 1.5rem 0.75rem;
        min-height: 250px;
    }

    .welcome-title {
        font-size: 1.25rem;
    }

    .welcome-description {
        font-size: 0.9rem;
    }

    .feature-item {
        flex: 1 1 100%;
        min-width: 100%;
        margin-bottom: 0.5rem;
    }

    .content-header {
        padding: 0.5rem 0.75rem;
    }

    .content-title {
        font-size: 1.1rem;
    }

    .content-subtitle {
        font-size: 0.85rem;
    }

    .word-content {
        padding: 0.5rem 0.75rem;
    }

    .content-actions {
        padding: 0.5rem 0.75rem;
    }

    .word-item {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .word-title {
        font-size: 1.125rem;
    }

    .meaning-number {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.8rem;
    }

    .meaning-text {
        font-size: 0.9rem;
    }

    .action-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Better touch targets for mobile */
    .character-header,
    .range-item,
    .breadcrumb-item.clickable {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Smooth scrolling for all elements */
    html {
        scroll-behavior: smooth;
    }

    /* Mobile-specific loading indicator */
    .loading-indicator {
        text-align: center;
        padding: 2rem 1rem;
    }

    .loading-text {
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }
}
