
/* Nested Dropdown Styling */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    display: none; /* Hidden by default */
    position: absolute;
    left: 100%; /* Position to the right of parent */
    top: 0;
    margin-top: -1px; /* Seamless alignment */
    min-width: 200px; /* Adjust as needed */
    z-index: 1000; /* Ensure submenus appear above other elements */
}

/* Show submenu on hover for desktop */
@media (min-width: 992px) {
    .dropdown-submenu:hover > .dropdown-menu {
        display: block;
    }
}

/* Mobile submenu styling */
@media (max-width: 991.98px) {
    .dropdown-submenu .dropdown-menu {
        position: static; /* Stack vertically on mobile */
        margin-left: 1rem;
        width: auto;
        display: none;
    }
    .dropdown-submenu.show > .dropdown-menu {
        display: block; /* Show when toggled */
    }
}

/* Ensure parent dropdown stays open */
.dropdown-menu.show {
    display: block;
}

/* Smooth transition for submenu appearance */
.dropdown-menu {
    transition: all 0.2s ease-in-out;
}

/* Ensure clickable submenu toggles */
.dropdown-submenu .dropdown-toggle {
    cursor: pointer;
}

/* Custom CSS for Urdupro.info */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* Typography */
body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: #333;
}

.urdu-text {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1.1em;
    text-align: right;
    direction: rtl;
}

/* Navigation */
.navbar {
    padding: 0.75rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    min-height: 500px;
}

/* Cards */
.card {
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.tool-card .tool-icon {
    text-align: center;
}

.word-card {
    transition: transform 0.3s ease;
}

.word-card:hover {
    transform: translateY(-3px);
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
}

/* Forms */
.form-control {
    border-radius: 6px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Tables */
.table th {
    font-weight: 600;
    background-color: var(--light-color);
}

/* Dictionary specific styles */
.dictionary-result {
    background: #fff;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 1rem 0;
}

.word-pronunciation {
    font-style: italic;
    color: var(--secondary-color);
    font-size: 0.9em;
}

.word-example {
    background: var(--light-color);
    padding: 0.75rem;
    border-radius: 4px;
    font-style: italic;
    margin: 0.5rem 0;
}

.related-words {
    margin-top: 1rem;
}

.related-words .badge {
    margin: 0.25rem;
}

/* Converter styles */
.converter-container {
    max-width: 800px;
    margin: 0 auto;
}

.converter-input, .converter-output {
    min-height: 150px;
    font-size: 1.1em;
}

.converter-output {
    background-color: var(--light-color);
    border: 2px solid #e9ecef;
    padding: 1rem;
    border-radius: 6px;
}

.urdu-output {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 1.3em;
    text-align: right;
    direction: rtl;
    line-height: 2;
}

/* Quiz styles */
.quiz-container {
    max-width: 700px;
    margin: 0 auto;
}

.quiz-question {
    background: #fff;
    border-radius: 10px;
    padding: 2rem;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.quiz-options .btn {
    margin: 0.5rem 0;
    text-align: left;
    padding: 1rem;
}

.quiz-result {
    text-align: center;
    padding: 2rem;
    border-radius: 10px;
    margin: 2rem 0;
}

.quiz-result.correct {
    background-color: rgba(40, 167, 69, 0.1);
    border: 2px solid var(--success-color);
}

.quiz-result.incorrect {
    background-color: rgba(220, 53, 69, 0.1);
    border: 2px solid var(--danger-color);
}

/* Vocabulary flashcard styles */
.flashcard {
    perspective: 1000px;
    height: 250px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: bold;
}

.flashcard-front {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
}

.flashcard-back {
    background: linear-gradient(135deg, var(--success-color) 0%, #1e7e34 100%);
    color: white;
    transform: rotateY(180deg);
}

/* Alphabet grid */
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.alphabet-letter {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.alphabet-letter:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.alphabet-letter .urdu-letter {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.alphabet-letter .roman-letter {
    font-weight: bold;
    color: var(--secondary-color);
}

.alphabet-letter .pronunciation {
    font-size: 0.8em;
    color: var(--secondary-color);
    font-style: italic;
}

/* Grammar tabs */
.nav-tabs .nav-link {
    border-radius: 6px 6px 0 0;
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tab-content {
    padding: 2rem;
    background: #fff;
    border: 2px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 6px 6px;
}

.grammar-table {
    margin: 1.5rem 0;
}

/* Footer */
footer {
    background-color: var(--dark-color) !important;
}

footer a {
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--primary-color) !important;
}

.social-icons a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.social-icons a:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Responsive design */
@media (max-width: 768px) {
    .hero-section .display-4 {
        font-size: 2rem;
    }
    
    .flashcard {
        height: 200px;
    }
    
    .alphabet-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .converter-input, .converter-output {
        min-height: 120px;
    }
}

@media (max-width: 576px) {
    .hero-section .display-4 {
        font-size: 1.75rem;
    }
    
    .alphabet-letter {
        padding: 1rem;
    }
    
    .alphabet-letter .urdu-letter {
        font-size: 2em;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Loading animations */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Print styles */
@media print {
    .navbar, footer, .btn, .social-icons {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}