* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 15px 20px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: #007bff;
    text-decoration: none;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
    align-items: center;
}

header nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}

header nav a:hover {
    color: #007bff;
}

#themeToggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

main {
    margin-top: 80px;
    padding: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.container {
    width: 100%;
}

.my-4 {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

h2.text-center, h2.mb-3 {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #007bff;
}

form {
    margin-bottom: 20px;
}

form .d-flex {
    display: flex;
}

form .flex-wrap {
    flex-wrap: wrap;
}

form .gap-2 {
    gap: 10px;
}

form label {
    font-weight: 500;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

form label:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

form input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
}

.mt-2 {
    margin-top: 10px;
}

form select, .form-select {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

.w-auto {
    width: auto;
}

.d-inline {
    display: inline-block;
}

form button, .btn {
    padding: 6px 12px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.2s;
}

form button:hover, .btn:hover {
    background-color: #0056b3;
}

.btn-primary {
    background-color: #007bff;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 13px;
}

.btn-outline-primary {
    background-color: transparent;
    color: #007bff;
    border: 1px solid #007bff;
}

.btn-outline-primary:hover {
    background-color: #007bff;
    color: white;
}

#switchBtn {
    display: block;
    margin: 0 auto 20px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: #28a745;
    color: white;
    cursor: pointer;
    font-weight: 500;
}

#switchBtn:hover {
    background-color: #218838;
}

table, .table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: white;
}

table th, table td {
    border: 1px solid #dee2e6;
    padding: 12px;
    text-align: left;
}

table th, .table-dark {
    background-color: #343a40;
    color: white;
    font-weight: 600;
}

.table-dark th {
    background-color: #343a40;
}

table tr:nth-child(even), .table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-hover tbody tr {
    transition: background-color 0.2s;
}

.table-hover tbody tr:hover {
    background-color: #e9ecef;
}

.table-logo {
    width: 25px;
    height: 25px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
}

.card-container {
    display: none;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.contest-card {
    width: 280px;
    padding: 20px;
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

.contest-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.contest-card h3 {
    font-size: 18px;
    margin-bottom: 12px;
    font-weight: 600;
}

.contest-card p {
    font-size: 14px;
    opacity: 0.95;
}

.platform-codeforces { background: linear-gradient(135deg, #1f8ef1, #0d6efd); }
.platform-codechef { background: linear-gradient(135deg, #fb641b, #d9541e); }
.platform-atcoder { background: linear-gradient(135deg, #3c3c3c, #1a1a1a); }
.platform-leetcode { background: linear-gradient(135deg, #ffa116, #f89c0e); }

footer {
    text-align: center;
    margin-top: 40px;
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

footer a {
    color: #007bff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.contact-page {
    max-width: 1200px;
    margin: 0 auto;
}

.contact-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.contact-intro {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px 0;
}

.intro-text {
    font-size: 15px;
    color: #666;
    max-width: 800px;
    margin: 10px auto 0;
    line-height: 1.5;
}

.contact-form-section {
    background: white;
    padding: 30px;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.contact-form-section h3 {
    margin-bottom: 20px;
    color: #007bff;
    font-size: 22px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    padding: 0;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.btn-submit {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    align-self: flex-start;
}

.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.direct-contact {
    background: white;
    padding: 30px;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.direct-contact h3 {
    margin-bottom: 20px;
    color: #007bff;
    font-size: 22px;
}

.contact-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s, box-shadow 0.2s;
}

.contact-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.contact-link .icon {
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.contact-link .icon svg {
    display: block;
}

.github-icon svg path {
    fill: #181717;
}

.link-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.link-content strong {
    font-size: 16px;
    color: #007bff;
}

.link-content span {
    font-size: 13px;
    color: #666;
}

.faq-section {
    background: white;
    padding: 30px;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.faq-section h3 {
    margin-bottom: 20px;
    color: #007bff;
    font-size: 22px;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.faq-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.faq-item h4 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
}

.faq-item p {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin: 0;
}

.social-section {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.social-section h3 {
    margin-bottom: 20px;
    color: #007bff;
    font-size: 22px;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #f8f9fa;
    border-radius: 50%;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.social-icon:hover {
    background: #007bff;
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}

.social-icon svg {
    width: 24px;
    height: 24px;
}

body.dark {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark header {
    background-color: #2d2d2d;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

body.dark .logo {
    color: #4da3ff;
}

body.dark header nav a {
    color: #e0e0e0;
}

body.dark header nav a:hover {
    color: #4da3ff;
}

body.dark table, body.dark .table {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark table th, body.dark .table-dark {
    background-color: #1a1a1a;
    color: #fff;
}

body.dark table td {
    border-color: #444;
}

body.dark table tr:nth-child(even) {
    background-color: #252525;
}

body.dark .table-hover tbody tr:hover {
    background-color: #333;
}

body.dark form select, body.dark .form-select {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-color: #444;
}

body.dark form label:hover {
    background-color: rgba(77, 163, 255, 0.1);
}

body.dark .contest-card {
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

body.dark .contest-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.7);
}

body.dark footer {
    background-color: #2d2d2d;
    color: #aaa;
    border-top: 1px solid #444;
}

body.dark h2.text-center, body.dark h2.mb-3 {
    color: #4da3ff;
}

body.dark .contact-form-section,
body.dark .direct-contact,
body.dark .faq-section,
body.dark .social-section {
    background-color: #2d2d2d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark .contact-form-section h3,
body.dark .direct-contact h3,
body.dark .faq-section h3,
body.dark .social-section h3 {
    color: #4da3ff;
}

body.dark .intro-text {
    color: #aaa;
}

body.dark .form-group label {
    color: #e0e0e0;
}

body.dark .form-group input,
body.dark .form-group textarea {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border-color: #444;
}

body.dark .form-group input:focus,
body.dark .form-group textarea:focus {
    border-color: #4da3ff;
    box-shadow: 0 0 0 3px rgba(77,163,255,0.1);
}

body.dark .contact-link {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark .contact-link .icon svg path {
    filter: brightness(1.2);
}

body.dark .contact-link .icon svg path[fill="#181717"] {
    fill: #e0e0e0;
}

body.dark .link-content strong {
    color: #4da3ff;
}

body.dark .link-content span {
    color: #aaa;
}

body.dark .faq-item {
    background: #1a1a1a;
    border-left-color: #4da3ff;
}

body.dark .faq-item h4 {
    color: #e0e0e0;
}

body.dark .faq-item p {
    color: #aaa;
}

body.dark .social-icon {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark .social-icon:hover {
    background: #4da3ff;
    color: white;
}

@media (max-width: 768px) {
    header {
        padding: 10px 15px;
    }

    .header-container {
        flex-direction: column;
        gap: 10px;
    }

    header nav ul {
        gap: 15px;
    }

    main {
        margin-top: 120px;
        padding: 15px;
    }

    table, #contestTable {
        display: none;
    }

    .card-container {
        display: flex;
    }

    #switchBtn {
        display: none;
    }

    .contest-card {
        width: 100%;
        max-width: 350px;
    }

    .contact-form-section,
    .direct-contact,
    .faq-section,
    .social-section {
        padding: 20px;
    }

    .contact-links {
        grid-template-columns: 1fr;
    }

    .faq-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    h2.text-center, h2.mb-3 {
        font-size: 22px;
    }
    
    form .d-flex {
        flex-direction: column;
    }
    
    .contest-card h3 {
        font-size: 16px;
    }
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #007bff;
}

.admin-header h2 {
    margin: 0;
    font-size: 28px;
    color: #007bff;
}

.btn-logout {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #dc3545;
    background-color: transparent;
    color: #dc3545;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-logout:hover {
    background-color: #dc3545;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.table-bordered {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: white;
}

.table-bordered thead {
    background: linear-gradient(135deg, #343a40, #495057);
}

.table-bordered thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
    padding: 15px 12px;
    color: white;
    border: 1px solid #495057;
}

.table-bordered tbody tr {
    transition: all 0.2s ease;
    background-color: white;
}

.table-bordered tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.table-bordered tbody tr:hover {
    background-color: #e3f2fd !important;
    transform: scale(1.002);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.table-bordered tbody td {
    vertical-align: middle;
    padding: 15px 12px;
    font-size: 14px;
    color: #333;
    border: 1px solid #dee2e6;
}

.table-bordered tbody tr.table-light {
    background-color: #f8f9fa !important;
    opacity: 0.7;
}

.table-bordered tbody tr.table-light td {
    color: #6c757d !important;
}

.table-bordered tbody tr.table-light:hover {
    opacity: 0.85;
}

.table-bordered tbody a[href^="mailto:"] {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.table-bordered tbody a[href^="mailto:"]:hover {
    color: #0056b3;
    text-decoration: underline;
}

body.dark .table-bordered {
    background-color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.dark .table-bordered thead {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
}

body.dark .table-bordered thead th {
    color: white;
    border-color: #444;
}

body.dark .table-bordered tbody tr {
    background-color: #2d2d2d;
}

body.dark .table-bordered tbody tr:nth-child(even) {
    background-color: #252525;
}

body.dark .table-bordered tbody tr:hover {
    background-color: #3a3a3a !important;
}

body.dark .table-bordered tbody td {
    color: #e0e0e0;
    border-color: #444;
}

body.dark .table-bordered tbody tr.table-light {
    background-color: #1a1a1a !important;
    opacity: 0.65;
}

body.dark .table-bordered tbody tr.table-light td {
    color: #888 !important;
}

body.dark .table-bordered tbody tr.table-light:hover {
    opacity: 0.8;
}

body.dark .table-bordered tbody a[href^="mailto:"] {
    color: #4da3ff;
}

body.dark .table-bordered tbody a[href^="mailto:"]:hover {
    color: #6bb3ff;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.bg-success {
    background-color: #28a745;
    color: white;
}

.bg-warning {
    background-color: #ffc107;
    color: #000;
}

.text-dark {
    color: #000 !important;
}

.action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
}

.action-buttons form {
    margin: 0;
}

.btn-action {
    padding: 8px 14px;
    border: 2px solid;
    background-color: transparent;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-action-read {
    border-color: #28a745;
    color: #28a745;
}

.btn-action-read:hover {
    background-color: #28a745;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.btn-action-delete {
    border-color: #dc3545;
    color: #dc3545;
}

.btn-action-delete:hover {
    background-color: #dc3545;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

body.dark .btn-action-read {
    border-color: #28a745;
    color: #4ade80;
}

body.dark .btn-action-read:hover {
    background-color: #28a745;
    color: white;
}

body.dark .btn-action-delete {
    border-color: #dc3545;
    color: #f87171;
}

body.dark .btn-action-delete:hover {
    background-color: #dc3545;
    color: white;
}

.card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

.card-body {
    padding: 30px;
}

.card.shadow {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.form-control {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.w-100 {
    width: 100%;
}

.text-muted {
    color: #6c757d;
    text-decoration: none;
    font-size: 14px;
}

.text-muted:hover {
    color: #007bff;
}

body.dark .admin-header {
    border-bottom-color: #4da3ff;
}

body.dark .admin-header h2 {
    color: #4da3ff;
}

body.dark .table-bordered {
    background-color: #2d2d2d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark .table-bordered thead {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
}

body.dark .table-bordered tbody tr:hover {
    background-color: #333;
}

body.dark .table-bordered tbody td {
    color: #e0e0e0;
    border-color: #444;
}

body.dark .table-bordered tbody a[href^="mailto:"] {
    color: #4da3ff;
}

body.dark .table-bordered tbody a[href^="mailto:"]:hover {
    color: #6bb3ff;
}

body.dark .btn-action-read {
    border-color: #28a745;
    color: #28a745;
}

body.dark .btn-action-delete {
    border-color: #dc3545;
    color: #dc3545;
}

body.dark .alert-info {
    background-color: #1a3a4a;
    border-color: #2a4a5a;
    color: #a8d8ea;
}

body.dark .alert-info h4,
body.dark .alert-info p {
    color: #a8d8ea;
}

body.dark .card {
    background-color: #2d2d2d;
}

body.dark .form-label {
    color: #e0e0e0;
}

body.dark .form-control {
    background-color: #1a1a1a;
    color: #e0e0e0;
    border-color: #444;
}

body.dark .form-control:focus {
    border-color: #4da3ff;
    box-shadow: 0 0 0 3px rgba(77,163,255,0.1);
}

@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .admin-header h2 {
        font-size: 22px;
    }

    .btn-logout {
        align-self: flex-end;
    }

    .table-bordered {
        font-size: 13px;
    }

    .table-bordered thead th,
    .table-bordered tbody td {
        padding: 10px 8px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 5px;
    }

    .btn-action {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .admin-header h2 {
        font-size: 18px;
    }

    .table-bordered thead {
        display: none;
    }

    .table-bordered tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 2px solid #dee2e6;
        border-radius: 8px;
        padding: 10px;
    }

    .table-bordered tbody td {
        display: block;
        text-align: left;
        padding: 8px 10px;
        border: none;
        border-bottom: 1px solid #dee2e6;
    }

    .table-bordered tbody td:last-child {
        border-bottom: none;
    }

    .table-bordered tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        margin-right: 10px;
        color: #007bff;
    }

    .action-buttons {
        flex-direction: row;
        justify-content: flex-start;
    }
}

.table-bordered tbody tr.table-light td {
    color: #6c757d;
}

body.dark .table-bordered tbody tr.table-light td {
    color: #999;
}

* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

button, .btn, a {
    transition: all 0.3s ease;
}
