/* Custom styles for Exam System */

:root {
    --primary-color: #1a237e; /* Dark blue */
    --primary-light: #534bae;
    --primary-dark: #000051;
    --primary-text: #ffffff;
    --primary-hover: #283593;
    --primary-transparent: rgba(26, 35, 126, 0.1);

    /* Bootstrap theme color overrides */
    --bs-primary: #1a237e;
    --bs-primary-rgb: 26, 35, 126;
    --bs-primary-text: #1a237e;
    --bs-primary-bg-subtle: rgba(26, 35, 126, 0.1);
    --bs-primary-border-subtle: #534bae;
    --bs-link-color: #1a237e;
    --bs-link-hover-color: #000051;
    --bs-nav-link-color: #1a237e;
    --bs-nav-link-hover-color: #283593;
    --bs-nav-pills-link-active-bg: #1a237e;
    --bs-nav-pills-link-active-color: #ffffff;
}

/* Additional Bootstrap component overrides */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

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

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

.pagination .page-link {
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--primary-text);
}

.list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Body styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
    background-image: url('/images/logo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 50%;
    background-attachment: fixed;
    background-blend-mode: overlay;
}

/* Main content */
main {
    flex: 1 0 auto;
    margin-bottom: 10rem;  /* Add space before footer */
}

/* Footer styles */
.footer {
    margin-top: auto;
    padding: 1rem 0;
    background-color: #E8EAF6; /* Indigo 50 */
    border-top: 1px solid #C5CAE9; /* Indigo 100 */
    color: #1A237E; /* Indigo 900 */
}

.footer a {
    color: #3F51B5 !important; /* Indigo 500 */
    opacity: 0.9;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer a:hover {
    opacity: 1;
    color: #1A237E !important; /* Indigo 900 */
}

.footer h5 {
    color: #283593; /* Indigo 800 */
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer .social-links a {
    font-size: 1.25rem;
    margin-right: 1rem;
    color: #3F51B5 !important; /* Indigo 500 */
}

.footer .social-links a:hover {
    color: #1A237E !important; /* Indigo 900 */
}

/* Card styles */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: none;
    transition: transform 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
}

/* Form styles */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem var(--primary-transparent);
}

/* Button styles */
.btn {
    font-weight: 500;
    letter-spacing: 0.5px;
}

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

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

/* Alert styles */
.alert {
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1000;
    border-left: 5px solid;
    padding-right: 4rem;
}

.alert:not(.alert-dismissible) {
    padding-right: 1.25rem;
}

.alert-danger {
    border-left-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

.alert-success {
    border-left-color: #198754;
    background-color: rgba(25, 135, 84, 0.1);
}

.alert-info {
    border-left-color: #0dcaf0;
    background-color: rgba(13, 202, 240, 0.1);
}

.alert-warning {
    border-left-color: #ffc107;
    background-color: rgba(255, 193, 7, 0.1);
}

.alert-dismissible {
    position: relative;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 1.25rem;
    opacity: 0.8;
    cursor: pointer;
}

.alert-dismissible .btn-close:hover {
    opacity: 1;
}

.alert h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 600;
}

.alert ul {
    margin-bottom: 0;
}

.alert.fade {
    transition: opacity 0.15s linear;
}

.alert.fade.show {
    opacity: 1;
}

/* Navigation styles */
.navbar {
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: var(--primary-color) !important;
}

.navbar.bg-light {
    background-color: var(--primary-color) !important;
}

.navbar-light .navbar-brand,
.navbar-light .navbar-nav .nav-link {
    color: var(--primary-text) !important;
    position: relative;
    padding: 0.5rem 1rem;
    margin: 0 0.2rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-text) !important;
}

.nav-link {
    font-weight: 500;
    color: var(--primary-text) !important;
    opacity: 0.9;
}

.nav-link:hover,
.navbar-light .navbar-nav .nav-link:hover {
    color: var(--primary-text) !important;
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Active nav item styles */
.nav-link.active,
.navbar-light .navbar-nav .nav-link.active,
.nav-item.active > .nav-link {
    background-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.nav-link.active::after,
.navbar-light .navbar-nav .nav-link.active::after,
.nav-item.active > .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background-color: var(--primary-text);
    border-radius: 2px;
}

/* Dropdown styles in navbar */
.navbar .dropdown-menu {
    background-color: var(--primary-color);
    border: 1px solid var(--primary-light);
    margin-top: 0.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.navbar .dropdown-item {
    color: var(--primary-text);
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus,
.navbar .dropdown-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text);
}

/* Custom form validation styles */
.was-validated .form-control:valid,
.was-validated .form-select:valid {
    border-color: #198754;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
}

.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.slide-in {
    animation: slideInRight 0.5s ease-out forwards;
}

/* Card animations */
.card {
    animation: fadeIn 0.5s ease-out;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

/* Button animations */
.btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: all 0.5s ease;
}

.btn-primary:hover:before {
    left: 100%;
}

/* Nav link animations */
.nav-link {
    transition: all 0.3s ease;
}

.nav-link:hover {
    transform: translateY(-2px);
}

/* Alert animations */
.alert {
    animation: slideInRight 0.5s ease-out;
}

/* Footer link animations */
.footer .social-links a {
    transition: all 0.3s ease;
}

.footer .social-links a:hover {
    transform: translateY(-3px) scale(1.2);
}

/* Table row hover animation */
.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    transform: scale(1.01);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Card loading animation */
.card.loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Floating animation for specific elements */
.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Pulse animation for notifications or important elements */
.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

/* Add smooth transitions to all interactive elements */
a, button, input, select, textarea {
    transition: all 0.3s ease;
}

/* Dropdown menu animations */
.dropdown-menu {
    animation: fadeIn 0.2s ease-out;
    transform-origin: top;
}

.dropdown-item {
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    transform: translateX(5px);
}

/* Tab content animations */
.tab-pane {
    animation: fadeIn 0.3s ease-out;
}

/* Form focus animations */
.form-control:focus {
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
}

/* Custom utility classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-shadow:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Dropdown styles */
.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item:active {
    background-color: var(--primary-color);
}

/* Card header styles */
.card-header {
    background-color: var(--primary-transparent);
    border-bottom: 1px solid var(--primary-light);
}

/* Table styles */
.table > thead {
    background-color: var(--primary-transparent);
}

.table > tbody > tr:hover {
    background-color: var(--primary-transparent);
}

/* Tab styles */
.nav-tabs .nav-link {
    color: var(--primary-color) !important;
    font-weight: 500;
    border: none;
    padding: 0.75rem 1.25rem;
    margin-right: 0.5rem;
    transition: all 0.2s ease-in-out;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-hover) !important;
    border: none;
    border-bottom: 2px solid var(--primary-light);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
    border: none;
    border-bottom: 2px solid var(--primary-color);
    background-color: transparent;
}

.nav-tabs {
    border-bottom: 1px solid var(--primary-transparent);
}

.tab-content {
    padding-top: 1.5rem;
}

/* Card header tabs */
.card-header .nav-tabs {
    border-bottom: none;
    margin-bottom: -1rem;
}

.card-header .nav-tabs .nav-link {
    padding: 0.5rem 1rem;
    margin-bottom: 0;
}

.card-header .nav-tabs .nav-link.active {
    background-color: #fff;
    border-bottom-color: #fff;
}