/* assets/css/components.css - UI Component Styles */

/* Menu System */
.menu-container {
    position: absolute;
    top: -10px;
    left: 0;
}

.hamburger-menu {
    background: rgba(56, 142, 60, 0.1);
    border: 2px solid rgba(56, 142, 60, 0.3);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.hamburger-menu:hover {
    background: rgba(56, 142, 60, 0.2);
    border-color: #388e3c;
    transform: scale(1.05);
}

.hamburger-icon {
    width: 18px;
    height: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: #388e3c;
    transition: 0.3s ease;
    border-radius: 1px;
    transform-origin: center;
}

.hamburger-menu.active .hamburger-icon span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-menu.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-icon span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white !important;
    color: #333 !important;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(34, 87, 122, 0.2);
    min-width: 220px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 10px;
    border: 2px solid rgba(56, 142, 60, 0.1);
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-section {
    padding: 15px 0;
}

.filter-section-title {
    padding: 0 20px 15px;
    font-size: 12px;
    color: #666 !important;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    color: #333 !important;
}

.filter-option:hover {
    background: #f8f9fa;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    transition: 0.3s;
    border-radius: 12px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
    background: #2dd4bf;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.filter-option label {
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    flex: 1;
}

.word-count-badge {
    background: #388e3c;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Tab System */
.tab-container {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button.active {
    color: #388e3c;
    border-bottom-color: #388e3c;
}

.tab-button:hover:not(.active) {
    color: #555;
    background: rgba(56, 142, 60, 0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Learning State Indicator */
.learning-state-indicator {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.state-new { background: #2196f3; }
.state-learning { background: #ff9800; }
.state-review { background: #9c27b0; }
.state-mastered { background: #4caf50; }

/* Audio Controls */
.audio-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(56, 142, 60, 0.1);
    border: 2px solid rgba(56, 142, 60, 0.3);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 10;
}

.audio-button:hover {
    background: rgba(56, 142, 60, 0.2);
    border-color: #388e3c;
    transform: scale(1.05);
}

.audio-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.audio-button.loading {
    animation: spin 1s linear infinite;
}

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

/* Retention Prompt */
.retention-prompt {
    background: linear-gradient(135deg, #43a047, #388e3c);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(56, 142, 60, 0.3);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s ease;
    display: none;
}

.retention-prompt.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.retention-prompt.fade-out {
    opacity: 0;
    transform: translateY(-5px);
}

/* Statistics */
.stats {
    margin: 20px 0;
    padding: 20px;
    background: white !important;
    color: #333 !important;
    border-radius: 10px;
    display: none;
    border: 2px solid #e0e0e0;
}

.stats.show { 
    display: block; 
    border-color: #388e3c;
}

.stats h3 {
    color: #2e7d32; 
    margin-bottom: 20px;
    text-align: center;
    font-size: 18px;
}

.learning-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: white !important;
    color: #333 !important;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.learning-stat {
    text-align: center;
    padding: 10px;
    border-radius: 6px;
}

.learning-stat.new {
    background: #e3f2fd;
    color: #1565c0;
}

.learning-stat.learning {
    background: #fff3e0;
    color: #ef6c00;
}

.learning-stat.review {
    background: #f3e5f5;
    color: #7b1fa2;
}

.learning-stat.mastered {
    background: #e8f5e8;
    color: #2e7d32;
}

.learning-stat-number {
    font-size: 24px;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.learning-stat-label {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
}

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

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.category-title {
    font-weight: 600;
    color: #2e7d32;
    font-size: 14px;
}

.category-numbers {
    font-size: 12px;
    color: #666;
}

.stacked-progress-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin-bottom: 5px;
}

.progress-segment {
    height: 100%;
    float: left;
    transition: width 0.3s ease;
}

.studied-progress {
    background: #81c784;
}

.quiz-correct {
    background: #4caf50;
}

.quiz-incorrect {
    background: #ffab91;
}

.overall-stats {
    border-top: 2px solid #e0e0e0;
    padding-top: 15px;
    margin-top: 15px;
}

/* Modals */
.modal-overlay {
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 1000; 
    backdrop-filter: blur(3px);
}

.modal-content {
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    background: white !important; 
    color: #333 !important;
    padding: 30px; 
    border-radius: 15px; 
    max-width: 500px; 
    width: 90%; 
    box-shadow: 0 20px 40px rgba(34, 87, 122, 0.3);
    border: 2px solid rgba(56, 142, 60, 0.1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.learning-guide-modal {
    max-width: 600px;
}

.modal-header {
    color: #2e7d32 !important; 
    margin-bottom: 20px; 
    text-align: center;
    font-size: 20px;
    font-weight: 600;
}

.learning-guide-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.guide-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa !important;
    color: #333 !important;
    border-radius: 8px;
    border-left: 4px solid #388e3c;
}

.guide-section h4 {
    color: #2e7d32 !important;
    margin-bottom: 8px;
    font-size: 16px;
}

.guide-section p {
    color: #555 !important;
    line-height: 1.5;
    font-size: 14px;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block; 
    color: #2e7d32 !important; 
    margin-bottom: 5px; 
    font-weight: 500;
    font-size: 14px;
}

.form-input, .form-textarea {
    width: 100%; 
    padding: 12px; 
    border: 2px solid rgba(56, 142, 60, 0.2); 
    border-radius: 8px; 
    font-size: 14px; 
    box-sizing: border-box; 
    outline: none;
    transition: border-color 0.3s ease;
    background: white !important;
    color: #333 !important;
}

.form-input:focus, .form-textarea:focus {
    border-color: #388e3c;
}

.form-textarea {
    height: 100px; 
    resize: vertical; 
    font-family: inherit; 
    line-height: 1.4;
}

.form-buttons {
    text-align: center;
    margin-top: 20px;
}

/* Ensure all modal and dropdown children inherit proper colors */
.modal-content *,
.dropdown-menu * {
    color: inherit !important;
}

/* Additional safety overrides */
.modal-content p,
.modal-content div,
.modal-content span,
.dropdown-menu p,
.dropdown-menu div,
.dropdown-menu span {
    color: inherit !important;
}