/* TLA Contest System - Frontend Styles */
/* Tông màu cam/vàng giống tlaedu.com */

.tla-contest-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tla-contest-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5a623, #f7c948);
    border-radius: 12px;
    margin-bottom: 30px;
    color: #fff;
}

.tla-contest-header h2 {
    font-size: 28px;
    margin: 0 0 10px;
    color: #fff;
}

.tla-contest-header p {
    font-size: 16px;
    margin: 0;
    opacity: 0.9;
}

/* Filters */
.tla-contest-filters {
    margin-bottom: 25px;
}

.tla-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.tla-search-input:focus {
    outline: none;
    border-color: #f5a623;
}

.tla-filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tla-filter-btn {
    padding: 8px 20px;
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    color: #555;
}

.tla-filter-btn:hover {
    border-color: #f5a623;
    color: #f5a623;
}

.tla-filter-btn.active {
    background: #f5a623;
    border-color: #f5a623;
    color: #fff;
}

/* Contest Grid */
.tla-contest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Contest Card */
.tla-contest-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    border: 1px solid #f0f0f0;
}

.tla-contest-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.tla-card-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.tla-card-status.live {
    background: #e8f5e9;
    color: #2e7d32;
}

.tla-card-status.upcoming {
    background: #fff3e0;
    color: #e65100;
}

.tla-card-status.ended {
    background: #f5f5f5;
    color: #757575;
}

.tla-card-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.tla-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px;
    line-height: 1.4;
}

.tla-card-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 15px;
    line-height: 1.5;
}

.tla-card-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.tla-info-item {
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tla-info-icon {
    font-size: 16px;
}

/* Countdown */
.tla-countdown {
    background: #fff8e1;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
}

.tla-countdown-label {
    color: #f57f17;
    font-weight: 600;
}

.tla-countdown-timer {
    color: #e65100;
    font-weight: 700;
    font-family: monospace;
    font-size: 16px;
}

/* Buttons */
.tla-btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    width: 100%;
    box-sizing: border-box;
}

.tla-btn-primary {
    background: linear-gradient(135deg, #f5a623, #f7c948);
    color: #fff;
}

.tla-btn-primary:hover {
    background: linear-gradient(135deg, #e09520, #e6b83e);
    color: #fff;
    text-decoration: none;
}

.tla-btn-secondary {
    background: #f5f5f5;
    color: #555;
}

.tla-btn-secondary:hover {
    background: #e0e0e0;
    color: #333;
    text-decoration: none;
}

.tla-btn-disabled {
    background: #f0f0f0;
    color: #aaa;
    cursor: not-allowed;
}

.tla-card-action {
    margin-top: 10px;
}

.tla-no-contest {
    text-align: center;
    color: #999;
    font-size: 16px;
    padding: 40px;
}


/* Modal */
.tla-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tla-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tla-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f5a623, #f7c948);
    color: #fff;
}

.tla-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #fff;
}

.tla-exam-timer {
    font-size: 18px;
    font-weight: 700;
    font-family: monospace;
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 8px;
}

.tla-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.tla-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.tla-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    text-align: right;
}

/* Exam Questions */
.tla-exam-question {
    margin-bottom: 24px;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    border-left: 4px solid #f5a623;
}

.tla-exam-question h4 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #333;
}

.tla-exam-option {
    display: block;
    padding: 10px 14px;
    margin: 6px 0;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.tla-exam-option:hover {
    border-color: #f5a623;
    background: #fff8e1;
}

.tla-exam-option input[type="radio"] {
    margin-right: 10px;
}

.tla-exam-option.selected {
    border-color: #f5a623;
    background: #fff8e1;
}

/* Result */
.tla-result-summary {
    text-align: center;
    padding: 30px;
}

.tla-result-score {
    font-size: 48px;
    font-weight: 700;
    color: #f5a623;
    margin: 10px 0;
}

.tla-result-detail {
    margin-top: 20px;
}

.tla-result-item {
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    font-size: 14px;
}

.tla-result-item.correct {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.tla-result-item.wrong {
    background: #fce4ec;
    border-left: 4px solid #e53935;
}

/* Responsive */
@media (max-width: 768px) {
    .tla-contest-grid {
        grid-template-columns: 1fr;
    }

    .tla-contest-header h2 {
        font-size: 22px;
    }

    .tla-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .tla-modal-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .tla-card-info {
        grid-template-columns: 1fr;
    }
}


/* Leaderboard */
.tla-leaderboard-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.tla-leaderboard-header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f5a623, #f7c948);
    border-radius: 12px;
    margin-bottom: 25px;
    color: #fff;
}

.tla-leaderboard-header h2 {
    font-size: 28px;
    margin: 0 0 8px;
    color: #fff;
}

.tla-leaderboard-header p {
    margin: 0;
    opacity: 0.9;
}

.tla-leaderboard-filters {
    margin-bottom: 20px;
}

.tla-select {
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}

.tla-select:focus {
    outline: none;
    border-color: #f5a623;
}

.tla-lb-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.tla-lb-table thead {
    background: linear-gradient(135deg, #f5a623, #f7c948);
    color: #fff;
}

.tla-lb-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.tla-lb-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.tla-lb-table tbody tr:hover {
    background: #fff8e1;
}

.tla-top-rank {
    background: #fffde7 !important;
    font-weight: 600;
}

.tla-rank {
    font-weight: 700;
    font-size: 16px;
}

.tla-score {
    font-weight: 700;
    color: #f5a623;
    font-size: 16px;
}


/* Problems List */
.tla-problems-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.tla-problems-header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f5a623, #f7c948);
    border-radius: 12px;
    margin-bottom: 25px;
    color: #fff;
}

.tla-problems-header h2 {
    font-size: 28px;
    margin: 0 0 8px;
    color: #fff;
}

.tla-problems-header p {
    margin: 0;
    opacity: 0.9;
}

.tla-problem-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 20px 24px;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid #f5a623;
    transition: transform 0.2s;
}

.tla-problem-card:hover {
    transform: translateX(4px);
}

.tla-problem-title {
    margin: 0 0 6px;
    font-size: 17px;
    color: #333;
}

.tla-problem-contest {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 8px;
}

.tla-problem-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #777;
}

.tla-problem-action {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.tla-problem-score {
    font-weight: 700;
    font-size: 16px;
    padding: 4px 12px;
    border-radius: 8px;
}

.tla-problem-score.perfect {
    background: #e8f5e9;
    color: #2e7d32;
}

.tla-problem-score.partial {
    background: #fff8e1;
    color: #f57f17;
}

/* Problem Modal - Wide */
.tla-modal-wide {
    max-width: 1200px;
    width: 95%;
    height: 90vh;
}

.tla-problem-left {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    border-right: 1px solid #eee;
}

.tla-problem-left h3 {
    color: #f5a623;
    margin-top: 20px;
}

.tla-problem-left pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    overflow-x: auto;
}

.tla-problem-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.tla-code-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.tla-code-toolbar .tla-select {
    flex: 1;
    max-width: 250px;
}

.tla-code-toolbar .tla-btn {
    width: auto;
    padding: 10px 20px;
}

#tla-code-editor, .CodeMirror {
    flex: 1;
    min-height: 300px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.CodeMirror {
    height: auto;
    min-height: 300px;
}

/* Code Result */
.tla-code-result {
    margin-top: 12px;
    padding: 16px;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 14px;
}

.tla-code-result.success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}

.tla-code-result.partial-result {
    background: #fff8e1;
    border: 1px solid #ffe082;
}

.tla-code-result.error {
    background: #fce4ec;
    border: 1px solid #ef9a9a;
}

.tla-test-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 13px;
}

.tla-test-pass {
    color: #2e7d32;
    font-weight: 600;
}

.tla-test-fail {
    color: #c62828;
    font-weight: 600;
}

.tla-code-loading {
    text-align: center;
    padding: 20px;
    color: #f5a623;
    font-weight: 600;
}

@media (max-width: 768px) {
    .tla-modal-wide .tla-modal-body {
        flex-direction: column;
    }

    .tla-problem-left {
        border-right: none;
        border-bottom: 1px solid #eee;
        max-height: 40vh;
    }

    .tla-problem-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tla-problem-meta {
        flex-wrap: wrap;
    }
}


/* Class Assignments */
.tla-class-assignments {
    padding: 0;
}

.tla-assignment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.tla-assignment-item:hover {
    background: #fafafa;
}

.tla-assignment-item:last-child {
    border-bottom: none;
}

.tla-assignment-info h4 {
    margin: 6px 0;
    font-size: 16px;
    color: #333;
}

.tla-assignment-type {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.tla-type-quiz {
    background: #e3f2fd;
    color: #1565c0;
}

.tla-type-code {
    background: #f3e5f5;
    color: #7b1fa2;
}

.tla-assignment-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #777;
}

.tla-assignment-action {
    flex-shrink: 0;
}

.tla-assignment-action .tla-btn {
    width: auto;
    padding: 8px 20px;
    font-size: 13px;
}

.tla-join-class {
    max-width: 500px;
    margin: 0 auto 10px;
}

@media (max-width: 768px) {
    .tla-assignment-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tla-assignment-action .tla-btn {
        width: 100%;
    }
}


/* Login / Register */
.tla-login-wrapper {
    max-width: 420px;
    margin: 60px auto;
    padding: 0 20px;
}

.tla-login-box {
    background: #fff;
    border-radius: 16px;
    padding: 35px 30px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    border-top: 4px solid #f5a623;
}

.tla-logged-in {
    text-align: center;
    border-top: 4px solid #4caf50;
}

.tla-user-avatar {
    font-size: 56px;
    margin-bottom: 12px;
}

.tla-logged-in h3 {
    margin: 0 0 5px;
    color: #333;
    font-size: 22px;
}

.tla-logged-in p {
    color: #777;
    margin: 0 0 25px;
    font-size: 14px;
}

.tla-login-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tla-login-tabs {
    display: flex;
    margin-bottom: 28px;
    border-bottom: 2px solid #f0f0f0;
}

.tla-tab-btn {
    flex: 1;
    padding: 14px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 600;
    color: #aaa;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.tla-tab-btn:hover {
    color: #666;
}

.tla-tab-btn.active {
    color: #f5a623;
    border-bottom-color: #f5a623;
}

.tla-tab-content {
    display: none;
}

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

.tla-form-group {
    margin-bottom: 18px;
}

.tla-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.tla-form-group input[type="text"],
.tla-form-group input[type="email"],
.tla-form-group input[type="password"] {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    background: #fafafa;
}

.tla-form-group input:focus {
    outline: none;
    border-color: #f5a623;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.1);
}

.tla-form-group input[type="checkbox"] {
    margin-right: 6px;
}

.tla-form-msg {
    margin-top: 14px;
    font-size: 14px;
    text-align: center;
    min-height: 20px;
}

.tla-form-link {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
}

.tla-form-link a {
    color: #f5a623;
    text-decoration: none;
    font-weight: 500;
}

.tla-form-link a:hover {
    text-decoration: underline;
}


/* Expired assignment */
.tla-assignment-item.tla-expired {
    opacity: 0.7;
    background: #fafafa;
}

.tla-assignment-item.tla-expired h4 {
    color: #999;
}


/* Style nút header khi đã đăng nhập */
.logged-in .ast-header-button-1 {
    display: none;
}

/* User Dropdown */
.tla-user-dropdown-wrapper {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 999;
}

.tla-user-dropdown-btn {
    background: #fff;
    border: 2px solid #f5a623;
    color: #f5a623;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tla-user-dropdown-btn:hover {
    background: #f5a623;
    color: #fff;
}

.tla-user-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 160px;
    overflow: hidden;
}

.tla-user-dropdown-wrapper:hover .tla-user-dropdown-menu,
.tla-user-dropdown-wrapper.open .tla-user-dropdown-menu {
    display: block;
}

.tla-user-dropdown-menu a {
    display: block;
    padding: 12px 18px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.2s;
}

.tla-user-dropdown-menu a:last-child {
    border-bottom: none;
}

.tla-user-dropdown-menu a:hover {
    background: #fff8e1;
    color: #f5a623;
}

/* Ẩn dropdown khi chưa đăng nhập */
body:not(.logged-in) .tla-user-dropdown-wrapper {
    display: none;
}
