:root {
    --primary-color: #007790;
    --primary-color-light: #0096b3;
    --primary-color-dark: #005a6d;
    --dark-gray: #333333;
    --light-gray: #f0f0f0;
    --medium-gray: #cccccc;
}

/* Ensure footer stays at the bottom */
html, body {
    height: 100%;
}

body {
    background-color: var(--light-gray);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--dark-gray);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#main-content {
    flex: 1 0 auto;
}

.navbar {
    background-color: var(--primary-color) !important;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
}

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

.btn-outline-light {
    border-color: var(--primary-color);
    color: var(--primary-color);
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    background-color: white;
}

.btn-outline-light:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: var(--dark-gray);
    border-color: var(--dark-gray);
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    color: white;
}

.btn-secondary:hover {
    background-color: #222222;
    border-color: #222222;
}

.btn-info {
    background-color: var(--medium-gray);
    border-color: var(--medium-gray);
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
    color: var(--dark-gray);
}

.btn-info:hover {
    background-color: #bbbbbb;
    border-color: #bbbbbb;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 600;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.card {
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    border: none;
    background-color: white;
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: 20px 20px 0 0 !important;
    font-weight: 600;
    padding: 15px 20px;
    border: none;
}

.card-body {
    padding: 25px;
}

.form-control, .form-select {
    border-radius: 15px;
    padding: 12px 15px;
    border: 1px solid var(--medium-gray);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    background-color: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 119, 144, 0.25);
}

.input-group-text {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    border-radius: 15px 0 0 15px;
}

.rounded-large {
    border-radius: 20px !important;
}

.question-block {
    background-color: white;
    border: 1px solid var(--medium-gray);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.preformatted {
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    background-color: var(--light-gray);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    border: 1px solid var(--medium-gray);
    overflow-x: auto;
}

.alert {
    border-radius: 15px;
}

.table {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    overflow: hidden;
    background-color: white;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.nav-tabs .nav-link {
    border-radius: 15px 15px 0 0;
    border: 1px solid transparent;
    font-weight: 500;
}

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

.footer {
    background-color: var(--dark-gray);
    color: white;
    padding: 20px 0;
    border-radius: 20px 20px 0 0;
    margin-top: 40px;
    flex-shrink: 0;
}

.score-display {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary-color-light), var(--primary-color));
    color: white;
    margin: 20px 0;
}

.correct-answer {
    background-color: #d4edda;
    border-color: #c3e6cb;
    border-left: 4px solid #28a745;
}

.incorrect-answer {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    border-left: 4px solid #dc3545;
}

.test-card {
    height: 100%;
}

.btn-action {
    margin: 5px;
}

.container-main {
    max-width: 1200px;
}

.page-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
}

/* Custom Calendar Styles */
.custom-calendar {
    position: absolute;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 2500;
    width: 300px;
    padding: 20px;
    border: 1px solid var(--medium-gray);
}

.custom-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.custom-calendar-header button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.custom-calendar-header button:hover {
    background: var(--primary-color-dark);
}

.custom-calendar-title {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.custom-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}

.custom-calendar-day-name {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.8rem;
    padding: 5px 0;
}

.custom-calendar-day {
    padding: 8px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.custom-calendar-day:hover {
    background-color: #e9f7fb;
}

.custom-calendar-day.selected {
    background-color: var(--primary-color);
    color: white;
}

.custom-calendar-day.today {
    background-color: #e9f7fb;
    font-weight: bold;
    border: 1px solid var(--primary-color);
}

.custom-calendar-day.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.custom-calendar-day.disabled:hover {
    background-color: transparent;
}

.custom-calendar-time {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.custom-calendar-time input {
    width: 100%;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--medium-gray);
    text-align: center;
}

.custom-calendar-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.custom-calendar-actions button {
    padding: 8px 15px;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-calendar-actions .btn-cancel {
    background-color: var(--light-gray);
    border: 1px solid var(--medium-gray);
    color: var(--dark-gray);
}

.custom-calendar-actions .btn-cancel:hover {
    background-color: #e0e0e0;
}

.custom-calendar-actions .btn-ok {
    background-color: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: white;
}

.custom-calendar-actions .btn-ok:hover {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
}

/* Fix for border jumping on hover */
.card, .btn, .form-control, .form-select, .input-group-text, .alert, .table, .nav-tabs .nav-link {
    box-sizing: border-box;
}

/* JavaScript-based popup styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.active {
    visibility: visible;
    opacity: 1;
}

.popup-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    padding: 30px;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.popup-overlay.active .popup-container {
    transform: translateY(0);
}

.popup-header {
    margin-bottom: 20px;
}

.popup-header h3 {
    color: var(--primary-color);
    margin: 0;
}

.popup-body {
    margin-bottom: 25px;
}

.popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    width: 350px;
}

.notification {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 15px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left-color: #28a745;
}

.notification.error {
    border-left-color: #dc3545;
}

.notification.warning {
    border-left-color: #ffc107;
}

.notification .notification-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6c757d;
}

/* Ensure all buttons in my_tests.php use the primary color, but allow dark gray for specific buttons */
#my-tests-page .btn-primary,
#my-tests-page .btn-secondary,
#my-tests-page .btn-info,
#my-tests-page .btn-success {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

#my-tests-page .btn-danger {
    background-color: var(--dark-gray);
    border-color: var(--dark-gray);
    color: white;
}

#my-tests-page .btn-primary:hover,
#my-tests-page .btn-secondary:hover,
#my-tests-page .btn-info:hover,
#my-tests-page .btn-success:hover {
    background-color: var(--primary-color-dark);
    border-color: var(--primary-color-dark);
}

#my-tests-page .btn-danger:hover {
    background-color: #222222;
    border-color: #222222;
}

/* Style for question text display in tests */
.question-text-display {
    background-color: white;
    border: 1px solid var(--medium-gray);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    font-size: 1.1em;
    line-height: 1.6;
}

.question-text-display p {
    margin-bottom: 1rem;
}

.question-text-display h1,
.question-text-display h2,
.question-text-display h3,
.question-text-display h4,
.question-text-display h5,
.question-text-display h6 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.question-text-display ul,
.question-text-display ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.question-text-display li {
    margin-bottom: 0.5rem;
}

.question-text-display table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.question-text-display table th,
.question-text-display table td {
    padding: 0.75rem;
    vertical-align: top;
    border: 1px solid var(--medium-gray);
}

.question-text-display table th {
    background-color: var(--light-gray);
    font-weight: 600;
}

.question-text-display pre {
    background-color: var(--light-gray);
    border: 1px solid var(--medium-gray);
    border-radius: 10px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.question-text-display blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    background-color: var(--light-gray);
    border-radius: 0 10px 10px 0;
}