*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
html {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    font-size: 16px;
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5em 0;
    font-weight: 600;
    color: #ffffff;
}

p {
    line-height: 1.6;
}


.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5em;
    height: 4.5em;
    background-color: #161b22;
    border-bottom: 3px solid #fbca1f;
}

.main-header h1 {
    font-size: 1.8em;
    font-weight: 900;
    margin: 0;
    color: #fbca1f;
}

.content-wrapper {
    height: calc(100vh - 4.5em);
    display: flex;
    flex-direction: column;
}

.contest-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75em 1.5em;
    background-color: #0d1117;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

#quick-links {
    display: flex;
    gap: 0.75em;
}

.contest-workspace {
    display: flex;
    flex-grow: 1;
    height: 100%;
    overflow: hidden;
}

#question-panel,
#editor-panel {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#question-panel {
    border-right: 1px solid #30363d;
}

.btn {
    font-family: inherit;
    padding: 0.6em 1.3em;
    font-weight: 600;
    font-size: 0.95em;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: #fbca1f;
    border-color: #fbca1f;
    color: #111;
}

.btn-primary:hover {
    background-color: #e2b61a;
    border-color: #e2b61a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(251, 202, 31, 0.2);
}

.btn-secondary {
    background-color: #21262d;
    border-color: #30363d;
    color: #c9d1d9;
}

.btn-secondary:hover {
    background-color: #30363d;
    border-color: #8b949e;
    color: #ffffff;
}

#quit {
    background-color: #fbca1f;
    border: 1px solid #fbca1f;
    color: #111;
    font-family: inherit;
    padding: 0.6em 1.3em;
    font-weight: 600;
    font-size: 0.95em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#quit:hover {
    background-color: #e2b61a;
    border-color: #e2b61a;
}

#question-box {
    padding: 1.5em;
    background-color: #0d1117;
    flex-grow: 1;
    font-family: "Courier New", Courier, monospace;
    font-size: 1.05em;
    white-space: pre-wrap;
    color: #c9d1d9;
}

#question-box h2 {
    font-family: inherit;
    color: #fbca1f;
    border-bottom: 1px solid #30363d;
    padding-bottom: 0.5em;
}
#question-box p {
    font-family: inherit;
    white-space: normal;
}


#code-editor {
    padding: 1.5em;
    background-color: #161b22;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#code-editor h3 {
    margin: 0 0 1em 0;
    color: #8b949e;
    font-size: 1em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#code-editor #code-edit {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

#code-inp {
    width: 100%;
    flex-grow: 1;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-family: "Courier New", Courier, monospace;
    font-size: 1.1em;
    padding: 0.75em;
    white-space: pre;
    overflow: auto;
    resize: none;
}

#code-inp:focus {
    outline: none;
    border-color: #fbca1f;
    box-shadow: 0 0 0 3px rgba(251, 202, 31, 0.3);
}

#code-sub {
    margin-top: 1em;
    align-self: flex-start;
    flex-shrink: 0;
}

.custom-select-wrapper {
    position: relative;
}

#question-select {
    font-family: inherit;
    padding: 0.6em 1.3em;
    font-weight: 600;
    font-size: 0.95em;
    border: 1px solid #30363d;
    border-radius: 6px;
    background-color: #21262d;
    color: #c9d1d9;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5em;
}

.custom-select-wrapper::after {
    content: "▼";
    position: absolute;
    top: 50%;
    right: 1em;
    transform: translateY(-50%);
    font-size: 0.8em;
    color: #8b949e;
    pointer-events: none;
}

#snackbar {
    visibility: hidden;
    min-width: 250px;
    background-color: #c9d1d9;
    color: #111;
    text-align: center;
    border-radius: 6px;
    padding: 16px;
    position: fixed;
    z-index: 99;
    right: 30px;
    bottom: 30px;
    font-size: 1em;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#snackbar.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {
        bottom: 0;
        opacity: 0;
    }
    to {
        bottom: 30px;
        opacity: 1;
    }
}

@keyframes fadeout {
    from {
        bottom: 30px;
        opacity: 1;
    }
    to {
        bottom: 0;
        opacity: 0;
    }
}

#timer {
    background: #21262d;
    color: #fbca1f;
    padding: 0.6em 1.3em;
    font-weight: 900;
    font-size: 1.1em;
    border-radius: 6px;
    font-family: "Courier New", Courier, monospace;
}



.table-container {
    padding: 1.5em;
    overflow-x: auto;
    width: 100%;
    flex-grow: 1;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.05em;
    color: #c9d1d9;
}

table thead tr {
    background-color: #161b22;
    border-bottom: 2px solid #fbca1f;
}

table th {
    padding: 1em 1.25em;
    text-align: left;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tbody tr {
    border-bottom: 1px solid #30363d;
}


table tbody tr:nth-of-type(even) {
    background-color: #161b22;
}

table tbody tr:hover {
    background-color: #21262d;
}

table td {
    padding: 1em 1.25em;
    text-align: left;
    vertical-align: middle;
}

table td:first-child,
table th:first-child {
    text-align: center;
    color: #8b949e;
    font-weight: bold;
}

.go-back-link {
    display: none; 
}

table thead .header th {
    width: 20%; 
}

table thead .header th:not(:nth-child(1)):not(:nth-child(2)) {
    width: 6%; 
    text-align: center;
}

table tbody td:not(:nth-child(2)) {
    text-align: center;
    font-weight: bold;
    font-family: "Courier New", Courier, monospace;
}

table th:last-child,
table td:last-child {
    background-color: #21262d; 
    color: #fbca1f; 
    font-size: 1.1em;
}

.submissions-table th,
.submissions-table td {
    text-align: left; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif; 
    background-color: transparent; 
    font-size: 1.05em; 
    color: #c9d1d9; 
}

.submissions-table th:nth-child(1),
.submissions-table td:nth-child(1) {
    width: 5%;
    text-align: center;
    color: #8b949e;
}

.submissions-table th:nth-child(2),
.submissions-table td:nth-child(2) {
    width: 15%;
    text-align: center;
}

.submissions-table th:nth-child(3) {
    width: 50%;
}

.submissions-table th:nth-child(4),
.submissions-table td:nth-child(4) {
    width: 15%;
    text-align: center;
    font-weight: bold;
    color: #fbca1f;
}

.submissions-table th:nth-child(5),
.submissions-table td:nth-child(5) {
    width: 15%;
    text-align: center;
}

.submissions-table th:nth-child(3), .submissions-table td:nth-child(3),
.submissions-table th:nth-child(4), .submissions-table td:nth-child(4),
.submissions-table th:nth-child(5), .submissions-table td:nth-child(5) {
    text-align: center;
}


.login-page-wrapper {
    justify-content: center;
    align-items: center;
    height: calc(100vh - 4.5em - 3em); 
}

.login-container {
    width: 400px;
    padding: 2.5em;
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
}

#welcome-message {
    font-size: 1.8em;
    font-weight: 600;
    color: #fbca1f; 
    margin-bottom: 1.5em;
    line-height: 1.3;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 0.8em 1em;
    margin-bottom: 1.25em;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 1.1em;
    font-family: inherit;
}


.login-container input[type="text"]:focus,
.login-container input[type="password"]:focus {
    outline: none;
    border-color: #fbca1f;
    box-shadow: 0 0 0 3px rgba(251, 202, 31, 0.3);
}


.login-container .btn-primary {
    width: 100%;
    font-size: 1.2em;
    padding: 0.8em;
    margin-top: 0.5em;
}

.login-error {
    color: #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
    border: 1px solid #ff6b6b;
    padding: 0.8em;
    border-radius: 6px;
    margin-bottom: 1.25em;
    text-align: center;
    font-weight: 500;
}
.register-container {
    width: 700px;
}
.form-columns {
    display: flex;
    justify-content: space-between;
    gap: 1.5em; 
    margin-bottom: 1.25em;
}
.form-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.form-column input {
    margin-bottom: 1.25em;
}

.modal {
  display: none;
  position: fixed; 
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%; 
  height: 100%; 
  overflow: auto; 
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto; 
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 900px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  position: relative;
}

.close-btn {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 5px;
  right: 15px;
}

.close-btn:hover,
.close-btn:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

.btn-view-pdf {
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}