:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --disabled-bg: #f8f9fa;
    --border-color: #dee2e6;
    --bonus-color: #e67e22;
    --locked-bg: #edf2f7;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: var(--primary-color);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
}

.subject-informatika .container,
.subject-smart .container {
    width: 95%;
    max-width: 1800px;
    padding: 20px;
}

h1 {
    text-align: left;
    margin: 0;
    color: var(--primary-color);
}

.top-nav {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.search-container {
    margin: 15px 0;
    width: 100%;
    display: flex;
    justify-content: flex-start;
}

#student-search-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 18px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fdfdfd;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

#student-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 6px 12px rgba(46, 204, 113, 0.1);
    background: white;
}

.clear-search-btn {
    cursor: pointer;
    color: #95a5a6;
    font-size: 18px;
    font-weight: bold;
    background: none;
    border: none;
    padding: 0 5px;
    transition: color 0.2s;
    line-height: 1;
}

.clear-search-btn:hover {
    color: #e74c3c;
}

.back-btn {
    padding: 10px 18px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.back-btn:hover {
    background: #f8f9fa;
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateX(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

.header-metadata {
    text-align: left;
    color: #7f8c8d;
    max-width: 65%;
}

.header-metadata p {
    margin: 5px 0;
    font-size: 1.25em;
}

.header-metadata .semester-info {
    font-size: 1.4em;
    color: var(--primary-color);
}

.teacher-list {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
}

.teacher-item {
    display: inline-flex;
    align-items: center;
    background: #f1f3f5;
    border: 1px solid #ced4da;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    color: var(--primary-color);
    font-weight: 500;
}

.teacher-btn {
    background: none;
    border: none;
    padding: 0 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #95a5a6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.teacher-btn:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}

.teacher-btn.remove {
    margin-left: 2px;
}

.teacher-btn.remove:hover {
    color: #e74c3c;
}

.teacher-btn.add {
    width: 24px;
    height: 24px;
    border: 1px dashed var(--success-color);
    border-radius: 50%;
    color: var(--success-color);
    margin-left: 5px;
}

.teacher-btn.add:hover {
    background: #e8f5e9;
    border-style: solid;
}

.admin-select-teacher {
    border-radius: 4px;
    border: 1px solid var(--accent-color);
    padding: 2px 4px;
    font-size: 0.9em;
}

.name-order-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--primary-color);
    padding: 0 4px;
    margin-left: 5px;
    transition: transform 0.2s, color 0.2s;
    vertical-align: middle;
}

.name-order-toggle:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}

.attendance-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.unified-legend {
    position: absolute;
    top: 30px;
    right: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.legend-separator {
    height: 1px;
    background-color: #dee2e6;
    margin: 12px 0;
}

.rewards-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
    font-weight: 500;
    white-space: nowrap;
}

.legend-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.bonus-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

/* Ensure lecture view (if it uses different layout) doesn't over-center if not desired */
.subject-smart .bonus-cell {
    justify-content: flex-start;
    padding-left: 20px;
}

.bonus-input {
    width: 65px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: left;
    font-size: 14px;
    background: #fff;
    flex-shrink: 0;
}

.base-bonus-text {
    display: inline-block;
    flex-shrink: 0;
    text-align: left;
}

.bonus-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.bonus-btns-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.bonus-btn-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-direction: row;
    justify-content: flex-end;
}

.bonus-tally-container {
    display: flex;
    gap: 0.75px;
    align-items: center;
    position: relative;
    top: -1px;
}

.bonus-tally-mark {
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    font-size: 8px;
    line-height: 1;
    -webkit-text-stroke: 0.5px currentcolor;
}

.bonus-tally-mark:nth-child(5n) {
    margin-right: 3px;
}

.bonus-tally-mark:hover {
    color: #e74c3c;
}

.bonus-label-mini {
    font-size: 11px;
    font-weight: bold;
    color: #7f8c8d;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

/* Absence Colors and Highlighting */
.absence-1 {
    background-color: #f1c40f !important;
    color: black !important;
}

.absence-2 {
    background-color: #e67e22 !important;
    color: white !important;
}

.absence-3 {
    background-color: #e74c3c !important;
    color: white !important;
}

.absence-4 {
    background-color: #000 !important;
    color: white !important;
    font-weight: bold;
    text-align: center !important;
    vertical-align: middle !important;
    display: table-cell !important;
    position: relative;
}

.absence-4::after {
    content: "✖";
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 14px;
    line-height: 1;
}

.student-name-cell.absence-1,
.student-name-cell.absence-2,
.student-name-cell.absence-3 {
    padding: 2px 8px;
    border-radius: 4px;
}






.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #fdfdfd;
    border-left: 5px solid var(--accent-color);
    flex-wrap: wrap;
    gap: 10px;
}

.tabs-nav {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
    flex-wrap: nowrap;
    justify-content: stretch;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabs-nav::-webkit-scrollbar {
    height: 4px;
}

.tabs-nav::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tabs-nav::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.tabs-nav::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.tab-btn {
    padding: 10px 15px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    border-radius: 8px 8px 0 0;
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--accent-color);
    background: rgba(52, 152, 219, 0.05);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background: rgba(52, 152, 219, 0.08);
}

.tab-btn-mini {
    padding: 1px 0;
    font-size: 11.5px;
    font-weight: 500;
    color: #7f8c8d;
    flex: 1 1 auto;
    min-width: 35px;
    white-space: normal;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tab-sub-info {
    font-size: 0.85em;
    opacity: 0.85;
    margin-top: 0;
    line-height: 1;
}

.tab-main-info {
    color: #000;
    font-weight: 700;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th,
td {
    padding: 12px 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

th:nth-child(2),
td:nth-child(2) {
    text-align: left;
    padding-left: 20px;
}

#bonus-header {
    text-align: left;
    padding-left: 20px;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.9em;
    position: relative;
    vertical-align: bottom;
}

tr:nth-child(even) {
    background-color: #fafafa;
}

tr:hover {
    background-color: #f1f4f9;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.sum-cell {
    font-weight: bold;
}

.header-filter-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.sum-filter-select {
    padding: 2px;
    font-size: 11px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    color: var(--primary-color);
}

.sum-filter-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.bonus-cell {
    color: var(--bonus-color);
    font-weight: bold;
}

#status-message {
    margin-top: 20px;
    text-align: center;
    font-weight: bold;
}

.active-col {
    background-color: rgba(52, 152, 219, 0.08) !important;
}

.locked-col {
    background-color: var(--locked-bg) !important;
    color: #a0aec0;
}

.locked-col input[type="checkbox"] {
    opacity: 0.3;
}

.holiday-col {
    background-color: rgba(231, 76, 60, 0.1) !important;
    color: #e74c3c !important;
}

.holiday-col .week-num {
    color: #e74c3c;
    opacity: 0.8;
}

tfoot {
    background-color: #f1f4f9;
    border-top: 2px solid var(--primary-color);
}

tfoot td {
    padding: 12px 8px;
}

footer {
    margin-top: 40px;
    padding: 30px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: center;
    color: #6c757d;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 5px;
}

#admin-badge-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.footer-info p {
    margin: 4px 0;
}

.footer-info strong {
    color: var(--primary-color);
    letter-spacing: 1px;
}

.admin-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    color: #6c757d;
    transition: all 0.2s;
    font-weight: 500;
}

.admin-btn:hover {
    background: #f8f9fa;
    border-color: #ced4da;
    color: var(--accent-color);
}

.admin-btn.logout {
    margin-left: 10px;
    background: rgba(231, 76, 60, 0.05);
    border-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.admin-btn.logout:hover {
    background: #e74c3c;
    color: white;
}

.activity-sub-btn:hover {
    background-color: var(--danger-color);
    color: white;
}

.date-header, .date-cell, .lecture-cell-dual, .week-header, .lecture-header-dual {
    width: 30px !important;
    min-width: 30px !important;
    padding: 8px 4px !important;
    font-size: 13px;
    text-align: center;
}
.date-header {
    background-color: var(--primary-color) !important;
    color: white !important;
}

body:not(.subject-smart):not(.subject-informatika) .z-cell,
body:not(.subject-smart):not(.subject-informatika) .z-sum-cell,
body:not(.subject-smart):not(.subject-informatika) .t-cell,
body:not(.subject-smart):not(.subject-informatika) .u-cell,
body:not(.subject-smart):not(.subject-informatika) .u-sum-cell,
body:not(.subject-smart):not(.subject-informatika) .s-sum-cell,
body:not(.subject-smart):not(.subject-informatika) .total-sum-cell {
    display: none !important;
}

body.subject-smart .z-cell,
body.subject-smart .z-sum-cell,
body.subject-smart .t-cell,
body.subject-smart .u-cell,
body.subject-smart .u-sum-cell,
body.subject-smart .s-sum-cell,
body.subject-smart .total-sum-cell,
body.subject-informatika .z-cell,
body.subject-informatika .z-sum-cell,
body.subject-informatika .t-cell,
body.subject-informatika .u-cell,
body.subject-informatika .u-sum-cell,
body.subject-informatika .s-sum-cell,
body.subject-informatika .total-sum-cell {
    display: table-cell !important;
}

.z-cell, .t-cell, .u-cell {
    width: 32px !important;
    min-width: 32px !important;
    padding: 8px 2px !important;
    text-align: center;
    display: table-cell !important;
    vertical-align: middle !important;
}

.z-sum-cell, .u-sum-cell, .s-sum-cell, .total-sum-cell {
    width: 32px !important;
    min-width: 32px !important;
    padding: 8px 2px !important;
    text-align: center;
    display: table-cell !important;
    vertical-align: middle !important;
    font-weight: bold;
    color: var(--bonus-color);
}

.z-input, .t-input, .u-input {
    width: 26px;
    text-align: center;
    border: 1px solid #bdc3c7 !important;
    background: white !important;
    border-radius: 3px;
    padding: 1px;
    outline: none;
    color: inherit;
    display: inline-block;
    vertical-align: middle;
}

#bonus-header {
    width: 60px !important;
    min-width: 60px !important;
    padding: 8px 2px !important;
    text-align: center !important;
    vertical-align: middle !important;
    line-height: normal !important;
}

.bonus-cell {
    width: 60px !important;
    min-width: 60px !important;
    padding: 8px 2px !important;
    text-align: center !important;
    display: table-cell !important;
    vertical-align: middle !important;
    line-height: normal !important;
}

.sum-header-cell {
    width: 55px !important;
    min-width: 55px !important;
    padding: 8px 2px !important;
    text-align: center !important;
    vertical-align: middle !important;
    line-height: normal !important;
}

.sum-cell {
    width: 55px !important;
    min-width: 55px !important;
    padding: 8px 2px !important;
    text-align: center !important;
    display: table-cell !important;
    vertical-align: middle !important;
    line-height: normal !important;
}

.base-bonus-text, .smart-total-bonus, .auto-bonus-display {
    display: inline-block;
    vertical-align: middle;
}

.sum-filter-select {
    width: auto !important;
    max-width: 45px;
    padding: 0 !important;
    font-size: 11px !important;
}

.bonus-input {
    width: 40px !important;
    padding: 1px !important;
    text-align: center;
    border: none !important;
    background: transparent !important;
    font-weight: bold;
    color: var(--bonus-color);
    outline: none;
    display: inline-block;
    vertical-align: middle !important;
    margin: auto 0;
}

.bonus-input::-webkit-outer-spin-button,
.bonus-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bonus-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.z-input::-webkit-outer-spin-button,
.z-input::-webkit-inner-spin-button,
.t-input::-webkit-outer-spin-button,
.t-input::-webkit-inner-spin-button,
.u-input::-webkit-outer-spin-button,
.u-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.z-input[type=number],
.t-input[type=number],
.u-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.admin-btn.primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
}

.admin-btn.primary:hover {
    background-color: #2980b9;
}

.admin-btn.info {
    background-color: #2c3e50;
    color: white;
    border: none;
}

.admin-btn.info:hover {
    background-color: #34495e;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.3);
}

.admin-btn.success {
    background-color: var(--success-color);
    color: white;
    border: none;
}

.admin-btn.success:hover {
    background-color: #219150;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.admin-badge {
    color: var(--success-color);
    font-weight: bold;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
}

.admin-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--success-color);
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 5px var(--success-color);
}

/* Header dynamic styles */
th .week-num {
    display: block;
    font-size: 0.75em;
    color: #7f8c8d;
    margin-bottom: 2px;
    font-weight: normal;
}

th .date-val {
    display: block;
    font-size: 1.1em;
}

/* Lock buttons */
.lock-btn {
    display: block;
    margin: 0 auto 5px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.5;
    transition: all 0.2s;
}

.lock-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

.lock-btn.locked {
    opacity: 1;
    color: var(--bonus-color);
}

.lock-icon {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
}

/* Informatics Lecture Dual Styles */
.lecture-header-dual {
    padding: 6px 2px !important;
    min-width: 45px;
}

.lock-btns-dual {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}

.lock-btn-mini {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px;
    font-size: 10px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
}

.lock-btn-mini:hover {
    opacity: 1;
    background: #f0f0f0;
}

.lock-btn-mini.locked {
    background: #fff3e0;
    border-color: var(--bonus-color);
    opacity: 1;
}

.dates-dual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.date-val-mini {
    font-size: 0.8em;
    font-weight: 500;
}

.date-val-mini.active-dt {
    color: var(--accent-color);
    font-weight: 700;
}

.lecture-cell-dual {
    background-color: #fbfcfe;
}

.checkbox-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.checkbox-pair input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.footer-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 320px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.modal-content h3 {
    margin-top: 0;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    text-align: center;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.modal-actions button {
    flex: 1;
}

/* Absence styling */
.absence-1 {
    color: #b8860b;
    /* DarkGoldenRod for better visibility on white */
    font-weight: 500;
}

.absence-2 {
    color: #e67e22;
    /* Carrot orange */
    font-weight: 600;
}

/* Access Overlay Styles */
/* Landing Page */
.landing-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    text-align: center;
    padding: 20px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.landing-page.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.landing-content {
    position: relative;
    background: white;
    padding: 60px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 90%;
    animation: fadeInScale 0.8s ease-out;
}

/* Bonus Buttons for SMART */
.bonus-btns-vertical {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 8px;
    /* Gap between buttons and trash */
    vertical-align: middle;
}

.name-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.bonus-btn-mini {
    padding: 1px 3px;
    font-size: 10px;
    font-weight: bold;
    color: white;
    background-color: var(--accent-color);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.2s;
}

.bonus-btn-mini:hover {
    background-color: #2980b9;
}

.bonus-btn-mini.pts-05 {
    background-color: #3498db;
}

.bonus-btn-mini.pts-1 {
    background-color: #2980b9;
}

.bonus-btn-mini.pts-2 {
    background-color: #1a5276;
}

.extra-bonus-container {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
    max-width: 60px;
    /* Force wrap after roughly 4 items */
}

.extra-bonus-display {
    font-size: 10px;
    font-weight: bold;
    color: #000;
    background: transparent;
    padding: 1px 3px;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
}

.extra-bonus-display:hover {
    background-color: #e74c3c;
    color: white;
    border: 1px solid white;
    border-radius: 3px;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.landing-logos {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.landing-logo {
    max-height: 150px;
    /* Increased from 100px */
    width: auto;
    max-width: 350px;
    /* Increased from 250px */
    object-fit: contain;
}

.landing-page h1 {
    font-size: 3.2em;
    /* Slightly larger */
    color: var(--primary-color);
    margin-bottom: 30px;
    font-weight: 800;
    letter-spacing: -1px;
    text-align: center;
}

.institution-info {
    margin-top: 45px;
    border-top: 2px solid #eee;
    padding-top: 35px;
}

.university-name {
    font-size: 1.8em;
    font-weight: 700;
    color: #2c3e50;
    margin: 10px 0;
}

.faculty-name {
    font-size: 1.4em;
    font-weight: 600;
    color: #34495e;
    margin: 8px 0;
}

.department-name {
    font-size: 1.8em;
    font-weight: 500;
    color: #7f8c8d;
    margin: 5px 0;
}

.subject-selection {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.subject-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 16px 25px;
    font-size: 1.25em;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    width: auto;
    min-width: 400px;
    max-width: 700px;
    text-align: center;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.subject-info {
    font-size: 0.6em;
    font-weight: 400;
    opacity: 0.85;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.subject-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
    background: #2980b9;
}

.subject-btn[data-subject="informatika"] {
    background: #95a5a6;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.subject-btn[data-subject="informatika"]:hover {
    background: #7f8c8d;
}

.subject-btn[data-subject="web"] {
    background: #27ae60;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.subject-btn[data-subject="web"]:hover {
    background: #219150;
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.subject-btn[data-subject="prog_tech"] {
    background: #e67e22;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

.subject-btn[data-subject="prog_tech"]:hover {
    background: #d35400;
    box-shadow: 0 8px 25px rgba(230, 126, 34, 0.4);
}

.subject-btn[data-subject="procesne_riadenie"] {
    background: #e74c3c;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.subject-btn[data-subject="procesne_riadenie"]:hover {
    background: #c0392b;
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

.subject-btn[data-subject="smart_vyroba"] {
    background: #8e44ad;
    box-shadow: 0 4px 15px rgba(142, 68, 173, 0.3);
}

.subject-btn[data-subject="smart_vyroba"]:hover {
    background: #7d3c98;
    box-shadow: 0 8px 25px rgba(142, 68, 173, 0.4);
}

/* Landing Page QR Generator Button */
.landing-tools-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.qr-generator-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #ffffff;
    text-decoration: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
}

.qr-generator-link-btn:hover {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 22px rgba(2, 132, 199, 0.5);
    color: #ffffff;
}

.qr-generator-link-btn .qr-gen-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* QR Generator Page Styles */
.qr-gen-page-wrapper {
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
}

.qr-gen-header {
    text-align: center;
    margin-bottom: 24px;
}

.qr-gen-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2b6cb0;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    padding: 6px 14px;
    background: #edf2f7;
    border-radius: 8px;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.qr-gen-back-btn:hover {
    background: #e2e8f0;
    color: #1a365d;
    transform: translateX(-2px);
}

.qr-gen-subtitle {
    color: #64748b;
    font-size: 1.02em;
    max-width: 620px;
    margin: 8px auto 0 auto;
    line-height: 1.5;
}

.qr-gen-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .qr-gen-container {
        grid-template-columns: 1fr;
    }
}

.qr-gen-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.qr-gen-card-title {
    font-size: 1.15em;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 10px;
}

.qr-form-group {
    margin-bottom: 16px;
}

.qr-form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9em;
    color: #334155;
    margin-bottom: 6px;
    text-align: left;
}

.qr-form-group .required-star {
    color: #ef4444;
}

.qr-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.qr-input:focus {
    outline: none;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.qr-id-input-group {
    display: flex;
    gap: 6px;
}

.qr-random-id-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.qr-random-id-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.qr-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.qr-btn-primary {
    flex: 1;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    border: none;
    padding: 12px 18px;
    font-size: 1em;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qr-btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
}

.qr-btn-secondary {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #64748b;
    padding: 12px 16px;
    font-size: 0.95em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.qr-btn-secondary:hover {
    background: #e2e8f0;
    color: #334155;
}

/* Card Preview Display */
.qr-preview-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-card-institute-tag {
    font-size: 0.75em;
    font-weight: 800;
    letter-spacing: 1px;
    color: #0369a1;
    text-transform: uppercase;
    background: #e0f2fe;
    padding: 3px 10px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: inline-block;
}

.qr-canvas-holder {
    width: 256px;
    height: 256px;
    margin: 10px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 10px;
    box-sizing: border-box;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
}

.qr-canvas-holder img,
.qr-canvas-holder canvas {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
}

.qr-card-student-name {
    font-size: 1.3em;
    font-weight: 800;
    color: #0f172a;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qr-card-student-id {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 1.05em;
    font-weight: 700;
    color: #0369a1;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    padding: 2px 10px;
    border-radius: 6px;
    margin-top: 6px;
    display: inline-block;
}

.qr-card-footer-note {
    font-size: 0.78em;
    color: #94a3b8;
    margin-top: 8px;
    font-style: italic;
}

.qr-download-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 16px;
}

.qr-download-btn {
    width: 100%;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #ffffff;
    border: none;
    padding: 12px 16px;
    font-size: 1.05em;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qr-download-btn:hover {
    background: linear-gradient(135deg, #15803d, #166534);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4);
}

.qr-placeholder-state {
    color: #94a3b8;
    padding: 40px 20px;
    text-align: center;
    font-size: 0.95em;
}

.access-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.access-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.access-box h2 {
    margin-top: 0;
    color: var(--primary-color);
}

.access-box input {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

/* User Access & Password Change */
.access-user-select {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    color: var(--primary-color);
    box-sizing: border-box;
}

/* Password Change Modal Specific Styles */
.password-change-modal {
    z-index: 2000 !important;
}

.password-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    text-align: left;
}

.password-input-group label {
    font-weight: 600;
    font-size: 14px;
    color: #4a5568;
}

.password-input-group input {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
}

.backup-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.backup-list-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    background: #f8f9fa;
}

.backup-text {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
}

.delete-backup-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    opacity: 0.6;
    transition: all 0.2s;
}

.delete-backup-btn:hover {
    color: #c0392b;
    opacity: 1;
    transform: scale(1.2);
}

.refresh-backup-btn {
    background: none;
    border: none;
    color: #3498db;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    opacity: 0.6;
    transition: all 0.2s;
}

.refresh-backup-btn:hover {
    color: #2980b9;
    opacity: 1;
    transform: scale(1.2);
}

.delete-backup-btn-small {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
    opacity: 0.5;
    transition: all 0.2s;
}

.delete-backup-btn-small:hover {
    color: #c0392b;
    opacity: 1;
}

.access-box button {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.access-box button:hover {
    background-color: #2980b9;
}

.error-msg {
    color: #e74c3c;
    margin-top: 10px;
}

/* Admin Recent Backups */
.recent-backups-container {
    width: 100%;
    max-width: 100%;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.recent-backups-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.backup-list-item {
    background: #fff;
    border: 1px solid #d1d8e0;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.85em;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 5px;
}

.backup-list-item i {
    color: #27ae60;
}

.backup-list-item .date {
    font-weight: bold;
}

.backup-list-item .time {
    color: #7f8c8d;
}

.hidden {
    display: none !important;
}

.main-content.hidden {
    display: none;
}

.remove-student-btn {
    background: white;
    border: 1px solid var(--border-color);
    color: #e74c3c;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    opacity: 0.9;
    transition: all 0.2s ease;
    float: right;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.remove-student-btn:hover {
    opacity: 1;
    background-color: #fff5f5;
    border-color: #e74c3c;
    transform: scale(1.05);
}

.remove-all-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 8px;
    transition: all 0.2s;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    float: right;
}

.remove-all-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.add-student-row td {
    background-color: #f8f9fa;
    border-top: 2px solid var(--border-color);
    padding: 10px;
}

.add-student-input {
    width: 250px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.add-student-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 7px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    margin-left: 10px;
    font-size: 13px;
}

.add-student-btn:hover {
    background-color: #219150;
}

.landing-version,
.landing-author {
    position: absolute;
    font-size: 11px;
    color: #95a5a6;
    opacity: 0.7;
}

.landing-version {
    top: 15px;
    right: 20px;
    text-transform: lowercase;
}

.landing-author {
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    text-align: center;
}

.auto-save-hint {
    font-size: 0.9em;
    color: #95a5a6;
    font-style: italic;
}

/* Student Activity Tally */
.student-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.name-actions-right {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.activity-add-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #bdc3c7;
    background: #fff;
    color: #7f8c8d;
    font-size: 11px;
    line-height: 14px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.activity-add-btn:hover,
.activity-sub-btn:hover {
    background: #f1f2f6;
    border-color: #3498db;
    color: #3498db;
    transform: scale(1.1);
}

.activity-sub-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.activity-sub-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #bdc3c7;
    background: #fff;
    color: #7f8c8d;
    font-size: 11px;
    line-height: 14px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.tally-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: 5px;
}

.tally-row {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 12px;
}

.tally-group {
    display: flex;
    align-items: center;
    gap: 1px;
    position: relative;
}

.tally-group.complete::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -1px;
    right: -1px;
    height: 1px;
    background-color: var(--accent-color);
    transform: translateY(-50%);
    pointer-events: none;
}

.tally-mark {
    width: 2px;
    height: 10px;
    background-color: var(--accent-color);
    border-radius: 1px;
    display: inline-block;
}

.remove-student-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    padding: 2px 5px;
}

.remove-student-btn:hover {
    opacity: 1;
    color: #e74c3c;
    transform: scale(1.1);
}

.landing-page {
    position: relative;
    min-height: 100vh;
}

/* Responsive layout overrides for SMART and INFORMATIKA subjects */
body.subject-smart .date-header, 
body.subject-smart .date-cell, 
body.subject-smart .week-header, 
body.subject-smart .z-cell, 
body.subject-smart .t-cell, 
body.subject-smart .u-cell, 
body.subject-smart .z-sum-cell, 
body.subject-smart .u-sum-cell, 
body.subject-smart .s-sum-cell, 
body.subject-smart .total-sum-cell,
body.subject-smart .bonus-cell,
body.subject-smart #bonus-header,
body.subject-smart .sum-cell,
body.subject-smart .sum-header-cell,
body.subject-informatika .z-cell,
body.subject-informatika .t-cell,
body.subject-informatika .sum-cell,
body.subject-informatika .sum-header-cell,
body.subject-informatika .z-sum-cell,
body.subject-informatika .total-sum-cell {
    width: auto !important;
}

body.subject-smart th:nth-child(2),
body.subject-smart td:nth-child(2) {
    width: 20%;
    max-width: 300px;
}

/* Voice Recognition & Mic Search Styles */
.mic-search-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    box-sizing: border-box;
    vertical-align: middle;
}

.mic-btn-icon,
.mic-search-btn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mic-search-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
    transform: scale(1.05);
}

.mic-search-btn.listening {
    background: #ff4757;
    color: white;
    border-color: #ff6b81;
    animation: mic-pulse 1.2s infinite;
}

@keyframes mic-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

.mic-suggestions-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 320px;
    max-width: 450px;
    padding: 12px;
    font-size: 0.9em;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.mic-status-msg {
    padding: 8px 10px;
    color: #4a5568;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
}

.mic-suggestions-title {
    font-size: 0.78em;
    font-weight: 700;
    color: #718096;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 5px;
}

.mic-suggestion-item {
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    background: #f8fafc;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.mic-suggestion-item:last-child {
    margin-bottom: 0;
}

.mic-suggestion-item:hover {
    background: #ebf8ff;
    border-color: #3182ce;
    color: #2b6cb0;
    transform: translateX(2px);
}

.mic-suggestion-item .match-name {
    font-weight: 600;
    color: #2d3748;
}

.mic-suggestion-item:hover .match-name {
    color: #2b6cb0;
}

.mic-suggestion-item .match-alt {
    font-size: 0.8em;
    color: #718096;
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
}


/* Camera / ISIC OCR / QR Scanner Styles */
.camera-search-btn,
.qr-search-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    box-sizing: border-box;
    vertical-align: middle;
    color: #1e293b;
}

.camera-btn-icon,
.camera-search-btn span,
.qr-btn-icon,
.qr-search-btn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transform: translateY(-1px);
}

.camera-search-btn:hover,
.qr-search-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
    transform: scale(1.05);
}

.camera-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.camera-modal-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35);
    padding: 20px;
    max-width: 520px;
    width: 95%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: slideUpIn 0.25s ease;
}

@keyframes slideUpIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.camera-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
    font-weight: 700;
    color: #2d3748;
}

.camera-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.camera-header-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.camera-switch-btn {
    background: #edf2f7;
    color: #2d3748;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.camera-switch-btn:hover {
    background: #e2e8f0;
    border-color: #a0aec0;
    transform: translateY(-1px);
}

.camera-modal-close-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #718096;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.camera-modal-close-btn:hover {
    background: #edf2f7;
    color: #1a202c;
}

/* Mode Switcher: Physical vs Mobile */
.camera-mode-switcher {
    display: flex;
    background: #edf2f7;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.camera-mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.88em;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.camera-mode-btn:hover {
    color: #1a202c;
}

.camera-mode-btn.active {
    background: #ffffff;
    color: #2b6cb0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.camera-instructions {
    text-align: center;
    font-size: 0.86em;
    color: #4a5568;
    background: #f7f8fa;
    border-radius: 8px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
}

.camera-video-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    width: 100%;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.camera-scan-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

/* Card Guide Physical (Landscape) */
.card-guide-physical {
    width: 90%;
    aspect-ratio: 1.585 / 1;
    max-height: 90%;
    border: 2px dashed rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    box-sizing: border-box;
}

.card-guide-header {
    position: absolute;
    top: 8px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.85;
}

.guide-badge {
    background: #0284c7;
    color: #fff;
    font-weight: 800;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.guide-title {
    color: #fff;
    font-size: 0.65em;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.card-guide-photo {
    position: absolute;
    right: 11%;
    top: 16%;
    width: 27.5%;
    height: 55%;
    border: 1.5px dashed rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

/* Name Zone for Physical Card (Box 1 - Blue) */
.card-guide-name-zone {
    position: absolute;
    left: 2%;
    top: 55.5%;
    width: 58%;
    height: 18.5%;
    display: flex;
    flex-direction: column;
}

.guide-target-label {
    position: absolute;
    top: -18px;
    left: 4px;
    font-size: 0.72em;
    font-weight: 700;
    color: #38bdf8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 2;
}

.guide-target-box {
    flex: 1;
    border: 2px solid #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
    overflow: hidden;
    transition: all 0.25s ease;
}

.guide-target-box.match-found {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.25) !important;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.7) !important;
}

/* Student ID Zone Physical (Box 3 - Red, under photo) */
.card-guide-studentid-zone-physical {
    position: absolute;
    left: 67%;
    top: 72%;
    width: 21.5%;
    height: 9.5%;
    display: flex;
    flex-direction: column;
}

.guide-target-studentid-label {
    position: absolute;
    top: -16px;
    left: 2px;
    font-size: 0.65em;
    font-weight: 700;
    color: #ef4444;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 2;
}

.guide-target-studentid-physical {
    flex: 1;
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, 0.12);
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
    overflow: hidden;
    transition: all 0.25s ease;
}

.guide-target-studentid-physical .target-corner {
    border-color: #ef4444;
}

.guide-target-studentid-physical.match-found {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.28) !important;
    box-shadow: 0 0 22px rgba(34, 197, 94, 0.8) !important;
}

.guide-target-studentid-physical.match-found .target-corner {
    border-color: #22c55e !important;
}

.studentid-target-text {
    font-size: 0.62em;
    font-weight: 800;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Barcode Zone Physical (Box 2 - Green, right edge full vertical strip) */
.card-guide-barcode-zone-physical {
    position: absolute;
    right: 0.8%;
    top: 1%;
    bottom: 1%;
    width: 9%;
    display: flex;
    flex-direction: column;
}

.guide-target-barcode-physical {
    flex: 1;
    border: 2px solid #22c55e;
    background: rgba(34, 197, 94, 0.12);
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
    overflow: hidden;
    transition: all 0.25s ease;
}

.guide-target-barcode-physical .target-corner {
    border-color: #22c55e;
}

.guide-target-barcode-physical.match-found {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.28) !important;
    box-shadow: 0 0 22px rgba(34, 197, 94, 0.8) !important;
}

.guide-target-barcode-physical.match-found .target-corner {
    border-color: #22c55e !important;
}

.barcode-vertical-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.62em;
    font-weight: 800;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.scan-laser-line-vertical {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, #22c55e, #fff, #22c55e, transparent);
    box-shadow: 0 0 8px #22c55e;
    animation: laserScanVertical 1.6s infinite ease-in-out;
}

@keyframes laserScanVertical {
    0% { left: 10%; opacity: 0.3; }
    50% { left: 90%; opacity: 1; }
    100% { left: 10%; opacity: 0.3; }
}

/* Target corners */
.target-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: #fff;
    border-style: solid;
}

.target-corner.tl { top: 0; left: 0; border-width: 2px 0 0 2px; }
.target-corner.tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.target-corner.bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.target-corner.br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.guide-target-text {
    font-size: 0.62em;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Scan laser animation */
.scan-laser-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #38bdf8, #fff, #38bdf8, transparent);
    box-shadow: 0 0 8px #38bdf8;
    animation: laserScan 1.6s infinite ease-in-out;
}

@keyframes laserScan {
    0% { top: 5%; opacity: 0.3; }
    50% { top: 90%; opacity: 1; }
    100% { top: 5%; opacity: 0.3; }
}

/* Card Guide Mobile (Portrait) */
.card-guide-mobile {
    height: 94%;
    aspect-ratio: 0.58 / 1;
    border: 2px dashed rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    box-sizing: border-box;
}

.mobile-guide-notch {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
}

.mobile-guide-header {
    position: absolute;
    top: 14px;
    left: 12px;
}

.guide-badge-small {
    background: #0d9488;
    color: #fff;
    font-weight: 800;
    font-size: 0.65em;
    padding: 1px 5px;
    border-radius: 3px;
}

.mobile-guide-photo {
    position: absolute;
    top: 13%;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.08);
}

.mobile-guide-name-zone {
    position: absolute;
    top: 29%;
    left: 8%;
    right: 8%;
    height: 25%;
    display: flex;
    flex-direction: column;
}

.guide-target-label-mobile {
    font-size: 0.70em;
    font-weight: 700;
    color: #2dd4bf;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    margin-bottom: 2px;
    text-align: center;
}

.guide-target-box-mobile {
    flex: 1;
    border: 2px solid #2dd4bf;
    background: rgba(45, 212, 191, 0.14);
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(45, 212, 191, 0.35);
    overflow: hidden;
    transition: all 0.25s ease;
}

.guide-target-box-mobile.match-found {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.25) !important;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.7) !important;
}

/* Barcode Zone Mobile (Bottom horizontal strip) */
.card-guide-barcode-zone-mobile {
    position: absolute;
    bottom: 5%;
    left: 7%;
    right: 7%;
    height: 23%;
    display: flex;
    flex-direction: column;
}

.guide-target-label-barcode {
    font-size: 0.68em;
    font-weight: 700;
    color: #38bdf8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    margin-bottom: 2px;
    text-align: center;
}

.guide-target-barcode-mobile {
    flex: 1;
    border: 2px solid #38bdf8;
    background: rgba(56, 189, 248, 0.14);
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
    overflow: hidden;
    transition: all 0.25s ease;
}

.guide-target-barcode-mobile.match-found {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.28) !important;
    box-shadow: 0 0 22px rgba(34, 197, 94, 0.8) !important;
}

.barcode-horizontal-text {
    font-size: 0.58em;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 800;
    user-select: none;
}

/* Live OCR status bar */
.camera-live-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    font-size: 0.85em;
}

.camera-live-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #2b6cb0;
    font-weight: 600;
}

.live-indicator-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    animation: livePulse 1.4s infinite ease-in-out;
}

@keyframes livePulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.3); opacity: 0.4; }
}

.camera-pause-btn {
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    color: #4a5568;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 0.82em;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s;
}

.camera-pause-btn:hover {
    background: #e2e8f0;
}

.camera-ocr-status {
    text-align: center;
    font-size: 0.88em;
    color: #4a5568;
    min-height: 22px;
    padding: 4px 6px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* Live Barcode Result Badge */
.camera-barcode-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 8px;
    padding: 6px 12px;
    gap: 8px;
    animation: slideUpIn 0.2s ease;
}

.barcode-badge-content {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88em;
    color: #15803d;
}

.barcode-badge-icon {
    font-size: 1.1em;
}

.barcode-badge-label {
    font-weight: 700;
}

.barcode-badge-value {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1.05em;
    font-weight: 800;
    color: #166534;
    letter-spacing: 0.8px;
    background: #dcfce7;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #bbf7d0;
}

.barcode-badge-actions {
    display: flex;
    gap: 6px;
}

.barcode-badge-action-btn {
    background: #ffffff;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.78em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.barcode-badge-action-btn:hover {
    background: #dcfce7;
    border-color: #22c55e;
    transform: translateY(-1px);
}

/* Live Student ID Result Badge (Box 3 - Reddish Theme) */
.camera-studentid-badge {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
}

.camera-studentid-badge .barcode-badge-content {
    color: #991b1b;
}

.camera-studentid-badge .barcode-badge-value {
    color: #b91c1c;
    background: #fee2e2;
    border-color: #fecaca;
}

.camera-studentid-badge .barcode-badge-action-btn {
    border-color: #fca5a5;
    color: #991b1b;
}

.camera-studentid-badge .barcode-badge-action-btn:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

/* Match result card */
.camera-match-result {
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: slideUpIn 0.2s ease;
}

.camera-match-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.camera-match-name {
    font-size: 1.05em;
    font-weight: 700;
    color: #166534;
}

.camera-match-barcode {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    border-radius: 5px;
    padding: 2px 7px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82em;
    font-weight: 700;
    margin-top: 2px;
}

.camera-match-studentid {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 5px;
    padding: 2px 7px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82em;
    font-weight: 700;
    margin-top: 2px;
}

.camera-match-score {
    font-size: 0.78em;
    font-weight: 700;
    background: #bbf7d0;
    color: #15803d;
    padding: 2px 7px;
    border-radius: 12px;
}

.camera-match-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.camera-btn-attendance {
    flex: 1;
    min-width: 140px;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
    transition: all 0.2s;
}

.camera-btn-attendance:hover {
    background: linear-gradient(135deg, #15803d, #14532d);
    transform: translateY(-1px);
}

.camera-btn-filter {
    background: #edf2f7;
    color: #2b6cb0;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.camera-btn-filter:hover {
    background: #e2e8f0;
}

.camera-suggestions-list {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
}

.camera-suggestions-title {
    font-size: 0.78em;
    font-weight: 700;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.camera-suggestion-item {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    background: #f8fafc;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.camera-suggestion-item:hover {
    background: #ebf8ff;
    border-color: #3182ce;
    transform: translateX(3px);
}

.camera-suggestion-item .match-name {
    font-weight: 600;
    color: #2d3748;
}

.camera-suggestion-item:hover .match-name {
    color: #2b6cb0;
}

.camera-suggestion-item .match-tag {
    font-size: 0.78em;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    color: #4a5568;
}

/* ==========================================================================
   QR Code Scanner Styles (Dual Field & Multi-Candidate Matching)
   ========================================================================== */
.qr-modal-box {
    max-width: 520px;
}

.qr-video-wrapper {
    aspect-ratio: 1 / 1;
    max-height: 380px;
    margin: 0 auto;
}

.qr-target-frame {
    position: relative;
    width: 260px;
    height: 260px;
    max-width: 82%;
    max-height: 82%;
    border: 1.5px dashed rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 5;
}

/* Fallback centering if qr-target-frame is placed directly inside qr-video-wrapper */
.qr-video-wrapper > .qr-target-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.qr-target-frame.match-found {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52), 0 0 26px rgba(34, 197, 94, 0.85) !important;
}

.qr-corner {
    position: absolute;
    width: 22px;
    height: 22px;
    border-color: #38bdf8;
    border-style: solid;
    transition: border-color 0.25s ease;
}

.qr-corner-tl { top: -2px; left: -2px; border-width: 3.5px 0 0 3.5px; border-top-left-radius: 12px; }
.qr-corner-tr { top: -2px; right: -2px; border-width: 3.5px 3.5px 0 0; border-top-right-radius: 12px; }
.qr-corner-bl { bottom: -2px; left: -2px; border-width: 0 0 3.5px 3.5px; border-bottom-left-radius: 12px; }
.qr-corner-br { bottom: -2px; right: -2px; border-width: 0 3.5px 3.5px 0; border-bottom-right-radius: 12px; }

.qr-target-frame.match-found .qr-corner {
    border-color: #22c55e !important;
}

.qr-laser-line {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #38bdf8, #ffffff, #38bdf8, transparent);
    box-shadow: 0 0 10px #38bdf8;
    animation: qrLaserScan 2s infinite ease-in-out;
}

@keyframes qrLaserScan {
    0% { top: 6%; opacity: 0.2; }
    50% { top: 92%; opacity: 1; }
    100% { top: 6%; opacity: 0.2; }
}

.qr-guide-text {
    font-size: 0.72em;
    font-weight: 800;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.65);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

/* Decoded data banner */
.qr-decoded-badge {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    padding: 9px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: slideUpIn 0.2s ease;
}

.qr-decoded-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qr-decoded-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.qr-field-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88em;
}

.qr-field-label {
    color: #64748b;
    font-weight: 600;
}

.qr-field-value {
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    display: inline-block;
}

.qr-number-value {
    font-family: 'Consolas', 'Courier New', monospace;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    letter-spacing: 0.5px;
}

.qr-name-value {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* Candidates list (Multiple matches) */
.qr-candidates-container {
    border-top: 1px solid #e2e8f0;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: slideUpIn 0.2s ease;
}

.qr-candidates-title {
    font-size: 0.85em;
    font-weight: 700;
    color: #c2410c;
    display: flex;
    align-items: center;
    gap: 6px;
}

.qr-candidates-list-scroll {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 2px;
}

.qr-candidate-card {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    background: #ffffff;
    border: 1.5px solid #fed7aa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.qr-candidate-card:hover {
    border-color: #ea580c;
    background: #fff7ed;
    transform: translateX(3px);
}

.qr-candidate-card.selected {
    border-color: #16a34a;
    background: #f0fdf4;
    box-shadow: 0 0 0 2px #86efac;
}

.qr-candidate-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.qr-candidate-name {
    font-weight: 700;
    font-size: 0.93em;
    color: #1e293b;
}

.qr-candidate-sub {
    font-size: 0.76em;
    color: #64748b;
}

.qr-candidate-badge {
    font-size: 0.78em;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    background: #ffedd5;
    color: #c2410c;
    border: 1px solid #fed7aa;
    white-space: nowrap;
}

.qr-candidate-card.selected .qr-candidate-badge {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}

.qr-candidate-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

/* Upload button */
.qr-upload-label {
    font-size: 0.9em;
}


/* ---- Voice meter + playback ---- */
#voice-meter-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    animation: fadeIn 0.3s ease;
}

#voice-meter-bar-wrapper {
    width: 100%;
    height: 60px;
    background: #0f172a;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
}

#voice-meter-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#voice-playback-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 0.85em;
    color: #0369a1;
    animation: fadeIn 0.3s ease;
}

#voice-playback-label {
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

#voice-playback-audio {
    flex: 1;
    height: 32px;
    outline: none;
}


/* Exact Match & Closest Suggestions UI */
.mic-exact-match-box {
    background: #f0fff4;
    border: 2px solid #38a169;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.15);
    animation: fadeIn 0.2s ease;
}

.mic-exact-header {
    margin-bottom: 8px;
}

.mic-exact-badge {
    background: #38a169;
    color: white;
    font-size: 0.75em;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mic-exact-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.mic-exact-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mic-student-name {
    font-size: 1.05em;
    font-weight: 700;
    color: #2d3748;
}

.mic-student-sub {
    font-size: 0.85em;
    color: #4a5568;
}

.mic-confirm-btn {
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 700;
    padding: 9px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(39, 174, 96, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
}

.mic-confirm-btn:hover {
    background: #219150;
    transform: scale(1.05);
    box-shadow: 0 6px 14px rgba(39, 174, 96, 0.4);
}

.mic-confirm-btn .check-icon {
    font-size: 1.25em;
    font-weight: 900;
}

.mic-closest-title {
    font-size: 0.8em;
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 5px;
}

.mic-closest-item {
    padding: 9px 12px;
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
    cursor: pointer;
}

.mic-closest-item:last-child {
    margin-bottom: 0;
}

.mic-closest-item:hover {
    background: #ebf8ff;
    border-color: #3182ce;
    transform: translateX(2px);
}

.mic-closest-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mic-score-tag {
    font-size: 0.85em;
    color: #4a5568;
    background: #edf2f7;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.mic-confirm-btn-small {
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    font-size: 0.88em;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.25);
    flex-shrink: 0;
    white-space: nowrap;
}

.mic-confirm-btn-small:hover {
    background: #219150;
    transform: scale(1.12);
    box-shadow: 0 4px 10px rgba(39, 174, 96, 0.35);
}

.mic-raw-text-footer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #e2e8f0;
    font-size: 0.8em;
    color: #718096;
    text-align: center;
}


/* Immediate Active State for Mic Button & Status */
.mic-search-btn.listening {
    background: #e53e3e !important;
    color: white !important;
    border-color: #c53030 !important;
    animation: mic-pulse 1.2s infinite !important;
    transform: scale(1.08) !important;
}

.mic-active-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    padding: 10px 14px;
    color: #c53030;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 6px;
    animation: fadeIn 0.2s ease;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e53e3e;
    display: inline-block;
    animation: dotPulse 1s infinite alternate;
    flex-shrink: 0;
}

@keyframes dotPulse {
    from { transform: scale(0.8); opacity: 0.6; }
    to { transform: scale(1.3); opacity: 1; }
}

/* Blinking animation for attendance check button */
@keyframes attendanceBlinkPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.7);
        transform: scale(1);
        background-color: #27ae60;
    }
    50% {
        box-shadow: 0 0 0 10px rgba(39, 174, 96, 0);
        transform: scale(1.02);
        background-color: #2ecc71;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
        transform: scale(1);
        background-color: #27ae60;
    }
}

.mic-attendance-blink-btn {
    animation: attendanceBlinkPulse 1.1s infinite ease-in-out !important;
    background: #27ae60 !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 16px !important;
    font-size: 0.98em !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.35) !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.mic-attendance-blink-btn:hover {
    background: #219150 !important;
    transform: scale(1.04) !important;
}

/* ==========================================================================
   Responsive Modal Sizing & Detection for Camera & QR Scanner (Mobile & Tablet)
   ========================================================================== */

/* TABLET (min-width: 641px and max-width: 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .camera-modal-overlay {
        padding: 20px !important;
    }

    .camera-modal-box,
    .qr-modal-box {
        width: 88% !important;
        max-width: 620px !important;
        padding: 18px 20px !important;
        gap: 12px !important;
        max-height: 92vh !important;
        border-radius: 16px !important;
        overflow-y: auto !important;
    }

    .qr-video-wrapper {
        aspect-ratio: 1 / 1 !important;
        max-height: 400px !important;
    }

    .qr-target-frame {
        width: 78% !important;
        height: 78% !important;
        max-width: 300px !important;
        max-height: 300px !important;
    }

    .qr-corner {
        width: 26px !important;
        height: 26px !important;
    }
}

/* TABLET SPECIFIC OVERRIDES VIA JS CLASS */
body.device-tablet .camera-modal-overlay {
    padding: 20px;
}

body.device-tablet .camera-modal-box,
body.device-tablet .qr-modal-box {
    width: 88%;
    max-width: 620px;
    padding: 18px 20px;
    gap: 12px;
    max-height: 92vh;
}

body.device-tablet .qr-target-frame {
    width: 78%;
    height: 78%;
    max-width: 300px;
    max-height: 300px;
}

/* MOBILE PHONES (max-width: 640px) */
@media (max-width: 640px) {
    .camera-modal-overlay {
        padding: 3px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .camera-modal-box,
    .qr-modal-box {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 8px 6px !important;
        gap: 7px !important;
        max-height: 98vh !important;
        max-height: calc(100dvh - 6px) !important;
        border-radius: 12px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        box-sizing: border-box !important;
    }

    .camera-modal-header {
        font-size: 0.94em !important;
        padding-bottom: 2px !important;
    }

    .camera-switch-btn {
        padding: 3px 8px !important;
        font-size: 0.76em !important;
        gap: 4px !important;
    }

    .camera-modal-close-btn {
        padding: 2px 6px !important;
        font-size: 1.15em !important;
    }

    .camera-mode-switcher {
        padding: 2px !important;
        gap: 2px !important;
        border-radius: 8px !important;
    }

    .camera-mode-btn {
        padding: 5px 8px !important;
        font-size: 0.78em !important;
    }

    .camera-instructions {
        padding: 4px 8px !important;
        font-size: 0.74em !important;
        line-height: 1.3 !important;
        border-radius: 6px !important;
    }

    .camera-live-bar {
        padding: 1px 4px !important;
        font-size: 0.76em !important;
    }

    .camera-ocr-status,
    .qr-scan-status {
        font-size: 0.78em !important;
        padding: 3px 6px !important;
        min-height: 20px !important;
    }

    .camera-video-wrapper {
        width: 100% !important;
        aspect-ratio: 4 / 3 !important;
        max-height: 48vh !important;
        border-radius: 8px !important;
    }

    .card-guide-physical {
        width: 96% !important;
        max-height: 96% !important;
    }

    .card-guide-mobile {
        height: 96% !important;
    }

    /* Enlarged QR Scanner Frame on Mobile */
    .qr-video-wrapper {
        width: 100% !important;
        aspect-ratio: 1 / 1 !important;
        max-height: min(78vw, 360px) !important;
        border-radius: 8px !important;
    }

    .qr-target-frame {
        width: 88% !important;
        height: 88% !important;
        max-width: 330px !important;
        max-height: 330px !important;
        border-radius: 16px !important;
    }

    .qr-corner {
        width: 32px !important;
        height: 32px !important;
    }

    .qr-corner-tl { border-width: 4px 0 0 4px !important; }
    .qr-corner-tr { border-width: 4px 4px 0 0 !important; }
    .qr-corner-bl { border-width: 0 0 4px 4px !important; }
    .qr-corner-br { border-width: 0 4px 4px 0 !important; }

    .qr-guide-text {
        font-size: 0.82em !important;
        letter-spacing: 1.5px !important;
    }

    /* Live badges compact layout */
    .camera-barcode-badge,
    .camera-studentid-badge,
    .qr-decoded-badge {
        padding: 4px 8px !important;
        font-size: 0.8em !important;
        gap: 5px !important;
        flex-wrap: wrap !important;
    }

    .barcode-badge-content,
    .qr-field-item {
        font-size: 0.8em !important;
    }

    .barcode-badge-value,
    .qr-field-value {
        font-size: 0.88em !important;
        padding: 1px 4px !important;
    }

    .barcode-badge-actions,
    .camera-match-actions {
        gap: 4px !important;
    }

    .barcode-badge-action-btn {
        padding: 3px 6px !important;
        font-size: 0.72em !important;
    }

    .camera-match-result,
    .qr-match-result {
        padding: 8px 10px !important;
        gap: 6px !important;
    }

    .camera-match-name {
        font-size: 0.94em !important;
    }

    .camera-btn-attendance,
    .camera-btn-filter,
    .camera-pause-btn {
        padding: 6px 10px !important;
        font-size: 0.8em !important;
    }
}

/* MOBILE SPECIFIC OVERRIDES VIA JS CLASS */
body.device-phone .camera-modal-overlay {
    padding: 3px !important;
}

body.device-phone .camera-modal-box,
body.device-phone .qr-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 8px 6px !important;
    gap: 7px !important;
    max-height: 98vh !important;
    max-height: calc(100dvh - 6px) !important;
    border-radius: 12px !important;
}

body.device-phone .qr-target-frame {
    width: 88% !important;
    height: 88% !important;
    max-width: 330px !important;
    max-height: 330px !important;
}

/* LANDSCAPE ORIENTATION ON MOBILE PHONES */
@media (max-width: 900px) and (orientation: landscape) {
    .camera-modal-overlay {
        padding: 2px !important;
    }

    .camera-modal-box,
    .qr-modal-box {
        max-height: 98vh !important;
        max-height: calc(100dvh - 4px) !important;
        padding: 6px !important;
        gap: 5px !important;
    }

    .camera-video-wrapper {
        max-height: 56vh !important;
    }

    .qr-video-wrapper {
        max-height: 54vh !important;
        width: auto !important;
        aspect-ratio: 1 / 1 !important;
        margin: 0 auto !important;
    }
}
