html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Programming Competition Platform Styles */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.sidebar .card {
    margin-bottom: 1rem;
}

.sidebar .card-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    font-weight: 500;
}

.contest-status {
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.problem-difficulty-stars {
    color: #ffc107;
}

.status-badge {
    border-radius: 20px;
    padding: 4px 8px;
    color: white !important;
    text-decoration: none;
    font-size: 0.75rem;
}

.news-card {
    transition: transform 0.2s ease-in-out;
    border: 1px solid #e9ecef;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.practice-category {
    transition: background-color 0.2s ease;
}

.practice-category:hover {
    background-color: #f8f9fa;
}

.practice-category.active {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.stats-card {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
}

.stats-number {
    font-size: 2rem;
    font-weight: bold;
}

.ranking-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.ranking-table th {
    background: #f8f9fa;
    border: none;
    color: #495057;
    font-weight: 600;
}

.ranking-table td {
    border: none;
    border-bottom: 1px solid #f1f3f4;
    padding: 12px 8px;
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;
    line-height: 60px;
    background-color: #f5f5f5;
}

/* =============================================
   Bootstrap 2 Compatibility & Custom Styles
   ============================================= */

/* Well styles */
.well-white {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 20px;
}

/* Row-fluid compatibility */
.row-fluid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.span6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 15px;
}

.span12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 15px;
}

@media (max-width: 768px) {
    .span6, .span12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Input prepend/append styles (Bootstrap 2 compat) */
.input-prepend {
    display: flex;
    align-items: stretch;
}

.input-prepend .add-on {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-right: 0;
    border-radius: 0.375rem 0 0 0.375rem;
    color: #495057;
}

.input-prepend input,
.input-prepend .input-xlarge,
.input-prepend .input-small {
    border-radius: 0 0.375rem 0.375rem 0;
    border: 1px solid #ced4da;
    padding: 0.375rem 0.75rem;
    flex: 1;
}

.input-prepend input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.input-xlarge {
    width: 100%;
    min-width: 220px;
}

.input-small {
    width: 80px;
}

/* Icon styles (Font Awesome / Glyphicon compatibility) */
[class^="icon-"], [class*=" icon-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome, sans-serif;
    font-style: normal;
    font-weight: 900;
    display: inline-block;
    width: 1em;
    text-align: center;
}

.icon-user::before { content: "\f007"; }
.icon-lock::before { content: "\f023"; }
.icon-envelope::before { content: "\f0e0"; }
.icon-tag::before { content: "\f02b"; }
.icon-book::before { content: "\f02d"; }
.icon-calendar::before { content: "\f073"; }
.icon-ok::before { content: "\f00c"; }
.icon-remove::before { content: "\f00d"; }
.icon-warning-sign::before { content: "\f071"; }
.icon-google-plus::before { content: "\f1a0"; font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", FontAwesome; font-weight: 400; }
.icon-facebook::before { content: "\f09a"; font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", FontAwesome; font-weight: 400; }
.icon-twitter::before { content: "\f099"; font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", FontAwesome; font-weight: 400; }
.icon-windows::before { content: "\f17a"; font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", FontAwesome; font-weight: 400; }

/* Form fieldsets */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

fieldset legend {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

fieldset ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

fieldset ol li {
    margin-bottom: 15px;
}

fieldset ol li label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

/* Title heading group */
hgroup.title {
    margin-bottom: 25px;
}

hgroup.title h1 {
    font-size: 2rem;
    margin-bottom: 5px;
    color: #333;
}

hgroup.title h2 {
    font-size: 1.2rem;
    color: #666;
    font-weight: normal;
}

/* Page header */
.page-header {
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.page-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

/* Validation styles */
.validation-summary-errors,
.field-validation-error {
    color: #dc3545;
    font-size: 0.875rem;
}

.field-validation-error {
    display: block;
    margin-top: 5px;
}

/* Social login partial */
.social-login-partial {
    margin-top: 20px;
}

.social-login-partial h3 {
    margin-bottom: 15px;
}

#socialLoginList button {
    margin-right: 10px;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#socialLoginList button i {
    font-size: 1.2rem;
}

/* Alert styles */
.alert {
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.alert .close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    opacity: 0.5;
    cursor: pointer;
    float: right;
}

.alert .close:hover {
    opacity: 0.75;
}

/* Button styles enhancement */
.btn-large {
    padding: 10px 20px;
    font-size: 1rem;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.875rem;
}

/* Card enhancements */
.card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.card-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-radius: 8px 8px 0 0 !important;
    font-weight: 500;
}

/* Table enhancements */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 123, 255, 0.03);
}

/* How-to section styles */
.howto {
    scroll-margin-top: 80px;
}

.howto h2 {
    color: #333;
}

.howto h5 {
    color: #0056b3;
    margin-top: 15px;
}

/* Select styling */
select.input-xlarge {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #fff;
}

select.input-xlarge:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Checkbox styling */
fieldset ol li.checkbox {
    display: flex;
    align-items: center;
}

fieldset ol li.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    font-weight: normal;
}

fieldset ol li.checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* External logins table */
#externalLogins .table td {
    vertical-align: middle;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        margin-top: 2rem;
    }
    
    .contest-card .d-flex {
        flex-direction: column;
    }
    
    .contest-card .d-flex > div:last-child {
        margin-top: 1rem;
        text-align: left !important;
    }
    
    .row-fluid {
        flex-direction: column;
    }
    
    .input-xlarge {
        min-width: 100%;
    }
    
    hgroup.title h1 {
        font-size: 1.5rem;
    }
    
    hgroup.title h2 {
        font-size: 1rem;
    }
}