/* Mobile First Design for KPSS Deneme v2.1.4 */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-bg: #f8fafc;
    --white: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

/* Global Container & Typography */
.kpss-dashboard-container,
.kpss-result-container,
.kpss-library-container,
.kpss-rankings-container,
.kpss-auth-container,
.kpss-exam-container {
    max-width: 1000px;
    margin: 20px auto;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: var(--text-color);
    padding: 0 15px;
    /* Side padding for mobile */
}

h1,
h2,
h3,
h4 {
    margin-top: 0;
    color: var(--text-color);
}

/* Common Components */
.kpss-card,
.dashboard-card,
.result-detail,
.kpss-auth-box,
.question-card,
.kpss-leaderboard-box,
.kpss-history-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpss-card:hover,
.kpss-history-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.text-center {
    text-align: center;
}

.mt-30 {
    margin-top: 30px;
}

.p-50 {
    padding: 50px;
}

/* Buttons */
.btn,
.btn-primary,
.btn-dark,
.btn-secondary,
.btn-detail {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.btn-block {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

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

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

.btn-dark {
    background: #0f172a;
    color: #fff;
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-color);
}

.btn-detail {
    background: var(--primary-color);
    color: #fff;
    font-size: 13px;
}

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 18px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.date-badge {
    background: #f1f5f9;
    color: #64748b;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Library / Exam List */
.kpss-header-center {
    text-align: center;
    margin-bottom: 30px;
}

.kpss-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.meta-info {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    font-size: 14px;
    color: var(--secondary-color);
}

/* Exam Taking Area (New) */
.kpss-lobby {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin: 40px auto;
    max-width: 600px;
}

.exam-sticky-header {
    background: var(--white);
    padding: 10px 20px;
    border-bottom: 2px solid var(--primary-color);
    position: sticky;
    top: 32px;
    /* Wordpress admin bar compatibility */
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin: -20px -15px 20px -15px;
    /* Negative margins to stretch full width in container */
}

body.admin-bar .exam-sticky-header {
    top: 32px;
}

body:not(.admin-bar) .exam-sticky-header {
    top: 0;
}

.exam-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.timer {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    background: #eff6ff;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--primary-color);
}

.question-text {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--text-color);
}

.options-grid {
    display: grid;
    gap: 12px;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.option-label:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.option-label input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.2);
    accent-color: var(--primary-color);
}

.opt-prefix {
    font-weight: bold;
    margin-right: 10px;
    min-width: 25px;
}

.opt-text {
    font-size: 16px;
}

/* Highlight selected option */
.option-label:has(input:checked) {
    border-color: var(--primary-color);
    background: #dbeafe;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Modal */
.kpss-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

/* Dashboard */
.section-header {
    margin-bottom: 25px;
    border-left: 5px solid var(--primary-color);
    padding-left: 15px;
}

.empty-dashboard {
    text-align: center;
    padding: 40px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--light-bg);
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-item {
    background: var(--light-bg);
    padding: 15px 10px;
    border-radius: 10px;
    text-align: center;
}

.stat-item small {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.stat-item .value {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
}

/* Stat Modifiers */
.stat-item.ranking .value {
    color: var(--warning-color);
}

.stat-item.gy .value {
    color: var(--success-color);
}

.stat-item.gk .value {
    color: var(--primary-color);
}

.scores-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.score-mini-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
    min-width: 80px;
    flex: 1;
}

.score-title {
    background: var(--secondary-color);
    color: #fff;
    padding: 4px;
    font-size: 11px;
}

.score-value {
    padding: 8px;
    font-weight: bold;
    color: var(--text-color);
}

.card-footer {
    text-align: right;
    margin-top: 15px;
}

.subject-breakdown {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 10px;
    margin-top: -10px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    border-top: none;
    position: relative;
    z-index: 0;
}

.subject-breakdown h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
}

/* Result Detail */
.result-header {
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    color: #fff;
    padding: 30px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.result-header h1 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 22px;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 12px;
    min-width: 120px;
}

.stat-box small {
    display: block;
    opacity: 0.8;
    font-size: 12px;
    margin-bottom: 5px;
}

.stat-box span {
    font-size: 24px;
    font-weight: bold;
}

.stat-box.highlight span {
    color: var(--warning-color);
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.score-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.score-val {
    font-size: 20px;
    font-weight: bold;
    margin-top: 5px;
    color: var(--text-color);
}

.detail-section {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.kpss-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
    /* Force scroll on small screens */
}

.kpss-table th,
.kpss-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 14px;
}

.kpss-table th {
    background: var(--light-bg);
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-size: 12px;
}

.kpss-table tr:last-child td {
    border-bottom: none;
}

.text-success {
    color: var(--success-color);
    font-weight: bold;
}

.text-danger {
    color: var(--danger-color);
    font-weight: bold;
}

.text-muted {
    color: var(--secondary-color);
}

.bold-net {
    font-weight: bold;
    color: var(--primary-color);
    background: var(--light-bg);
    border-radius: 6px;
}

/* Rankings */
.kpss-stats-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    color: #fff;
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.kpss-stats-card h3 {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin: 0;
}

.kpss-stats-card h2 {
    color: #fff;
    font-size: 28px;
    margin: 5px 0 0 0;
}

.my-score-info {
    text-align: right;
}

.my-score-info .value {
    font-size: 28px;
    font-weight: bold;
}

.kpss-leaderboard-box {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.kpss-header-area {
    padding: 20px;
    background: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.exam-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
}

.rankings-table .col-rank {
    width: 60px;
    text-align: center;
}

.rankings-table .col-score {
    width: 100px;
    text-align: center;
}

.rankings-table .col-date {
    width: 120px;
    text-align: center;
}

.row-me {
    background: #eff6ff !important;
}

.row-me td {
    color: var(--primary-color);
    font-weight: 600;
}

.rank-circle {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    background: var(--light-bg);
    border-radius: 50%;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
}

.me-badge {
    background: var(--primary-color);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    margin-left: 5px;
}

/* History Card Styles (New) */
.kpss-result-grid {
    display: grid;
    gap: 15px;
}

.kpss-history-card {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 20px;
}

.history-icon {
    width: 50px;
    height: 50px;
    background: #eff6ff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    flex-shrink: 0;
}

.history-info {
    flex-grow: 1;
}

.history-info h3 {
    font-size: 16px;
    margin: 0 0 5px 0;
}

.history-date {
    font-size: 12px;
    color: var(--secondary-color);
}

.history-stats {
    display: flex;
    gap: 20px;
}

.mini-stat {
    text-align: center;
}

.mini-stat small {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--secondary-color);
}

.mini-stat strong {
    font-size: 16px;
    color: var(--primary-color);
}

.btn-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--secondary-color);
    text-decoration: none;
    transition: all 0.2s;
}

.btn-arrow:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateX(3px);
}

/* Auth */
.kpss-auth-container {
    max-width: 800px;
}

.kpss-auth-box {
    border-top: 5px solid var(--primary-color);
}

.kpss-auth-box.register-box {
    border-top-color: #0f172a;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }


    .kpss-stats-card {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .my-score-info {
        text-align: center;
    }

    .kpss-header-area {
        flex-direction: column;
        align-items: flex-start;
    }

    .exam-select {
        width: 100%;
    }

    .scores-grid {
        grid-template-columns: 1fr;
    }

    .kpss-auth-container {
        flex-direction: column;
    }

    .kpss-auth-box {
        min-width: 100%;
    }

    .exam-title {
        font-size: 14px;
        max-width: 50%;
    }

    .timer {
        font-size: 14px;
        padding: 4px 10px;
    }

    .question-text {
        font-size: 16px;
    }

    .option-label {
        padding: 12px;
    }

    .opt-text {
        font-size: 15px;
    }

    .exam-sticky-header {
        padding: 10px;
        margin: -10px -10px 15px -10px;
    }

    /* Ranking Table Optimizations */
    .kpss-leaderboard-box {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin: 0 -15px 20px -15px;
    }

    /* Full width on mobile */
    .table-responsive {
        width: 100%;
        overflow-x: scroll;
    }

    .kpss-table {
        display: table;
        width: 100%;
        min-width: 0;
    }

    .kpss-table th,
    .kpss-table td {
        font-size: 12px;
        padding: 10px 8px;
    }

    .kpss-table .col-date {
        display: none;
    }

    /* Hide date on small screens */
    .col-rank {
        width: 40px !important;
    }

    .col-score {
        width: 70px !important;
    }

    .rank-circle {
        width: 22px;
        height: 22px;
        line-height: 22px;
        font-size: 11px;
    }

    .me-badge {
        display: block;
        width: fit-content;
        margin-top: 2px;
        margin-left: 0;
    }

    .kpss-header-area h3 {
        font-size: 16px;
    }

    /* History Card Mobile */
    .kpss-history-card {
        flex-wrap: wrap;
    }

    .history-info {
        width: calc(100% - 70px);
    }

    .history-stats {
        width: 100%;
        justify-content: space-around;
        background: var(--light-bg);
        padding: 10px;
        border-radius: 8px;
        margin-top: 10px;
    }

    .history-action {
        display: none;
    }

    /* Hide arrow on mobile, whole card clickable usually or just tap */
    .kpss-history-card::after {
        /* Clickable hint */
        content: "Detaylar >";
        display: block;
        width: 100%;
        text-align: center;
        color: var(--primary-color);
        font-size: 12px;
        margin-top: 10px;
        font-weight: bold;
    }
}

/* Unified Auth Styles */
.kpss-auth-container.unified-auth {
    max-width: 450px;
    margin: 60px auto;
    display: block;
}

.auth-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background: #e2e8f0;
    padding: 5px;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--secondary-color);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: var(--text-color);
}

.auth-tab.active {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.unified-auth .kpss-auth-box {
    border-top: none;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* Mobile Bottom Menu */
.kpss-mobile-gap {
    height: 80px;
    display: none; /* Only show when menu is active */
}

.kpss-mobile-menu {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: #ffffff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 5px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 9999;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.kpss-mobile-menu .menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--secondary-color);
    font-size: 10px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    width: 80px;
}

.kpss-mobile-menu .menu-item svg {
    margin-bottom: 4px;
    stroke: var(--secondary-color);
    transition: all 0.2s;
}

.kpss-mobile-menu .menu-item.active {
    color: var(--primary-color);
    background: #eff6ff;
}

.kpss-mobile-menu .menu-item.active svg {
    stroke: var(--primary-color);
    fill: rgba(37, 99, 235, 0.1);
}

.kpss-mobile-menu .menu-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.kpss-mobile-menu:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    transform: translateX(-50%) translateY(-2px);
}

/* Show gap when menu is present */
body:has(.kpss-mobile-menu) .kpss-mobile-gap {
    display: block;
}

@media (max-width: 768px) {
    .kpss-mobile-menu {
        bottom: 15px;
        width: 94%;
    }
}
