.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
    padding: 20px; /* ✅ Отступы со всех сторон */
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 440px;
    padding: 48px 40px 40px 40px;
    background: rgba(26, 31, 58, 0.95);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 212, 255, 0.2);
    animation: slideUp 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #8b92a8;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s;
    padding: 8px;
    line-height: 1;
}

.modal-close:hover {
    color: #00d4ff;
}

/* Tabs */
.auth-tabs {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    margin-bottom: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tabs .tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: #8b92a8;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    text-align: center;
}

.auth-tabs .tab.active {
    color: #00d4ff;
}

.auth-tabs .tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #00d4ff, #00e5ff);
}

/* Tab content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #d0d6e1;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 10px;
    color: #e8ebf0;
    font-size: 15px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #00d4ff;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-group input::placeholder {
    color: #6b7280;
}

/* Button */
.auth-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #00d4ff, #00e5ff);
    border: none;
    border-radius: 10px;
    color: #0a0e1a;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
    margin-top: 8px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.5);
}

.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Footer */
.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #8b92a8;
}

.auth-footer a {
    color: #00d4ff;
    text-decoration: none;
}

.auth-footer a:hover {
    color: #00e5ff;
    text-decoration: underline;
}

/* Error messages */
.error-message {
    padding: 12px;
    margin-bottom: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 14px;
    display: none;
    text-align: left;
}

.error-message.show {
    display: block;
}

/* Mobile optimizations */
@media (max-width: 600px) {
    .modal {
        padding: 16px;
    }
    
    .modal-content {
        width: 100%;
        max-width: none;
        padding: 28px 20px;
        border-radius: 16px;
    }
    
    .auth-tabs .tab {
        font-size: 15px;
        padding: 10px 8px;
    }
    
    .form-group input {
        font-size: 16px;
        padding: 12px 14px;
    }
    
    .auth-btn {
        padding: 12px;
        font-size: 15px;
    }
    
    .modal-close {
        top: 8px;
        right: 8px;
        font-size: 20px;
    }
}

/* Very small screens (< 400px) */
@media (max-width: 400px) {
    .modal {
        padding: 12px;
    }
    
    .modal-content {
        padding: 24px 16px;
    }
    
    .auth-tabs .tab {
        font-size: 14px;
        padding: 8px 6px;
    }
}


/* Container for the table */
.marks-list {
    max-height: 250px; /* Enable vertical scroll for long lists */
    overflow-y: auto;
    margin-bottom: 24px;
    border-radius: 8px; /* Rounded corners for the container */
    /* The main border will be on the table itself */
    border: 1px solid rgba(0, 212, 255, 0.2);
    background: rgba(0, 0, 0, 0.1);
}

/* Main table styles */
#marks-table {
    width: 100%;
    border-collapse: collapse; /* This is CRITICAL for grid lines */
    border-spacing: 0;
}

/* Cell and Header styles */
#marks-table th,
#marks-table td {
    padding: 12px 16px;
    text-align: center; /* Center-align text in all cells */
    /* This adds the vertical and bottom lines */
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    border-right: 1px solid rgba(0, 212, 255, 0.2);
}

/* Remove the extra border on the far right column */
#marks-table th:last-child,
#marks-table td:last-child {
    border-right: none;
}

/* Remove the extra bottom border from the last row */
#marks-table tr:last-child td {
    border-bottom: none;
}


/* Header-specific styles */
#marks-table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: #a2b4c9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: rgba(0, 212, 255, 0.1);
    position: sticky; /* Makes the header stay at the top on scroll */
    top: 0;
    z-index: 1; /* Ensures header is above table content */
}

/* Cell-specific styles */
#marks-table td {
    font-size: 0.9rem;
    color: #e8ebf0;
}

/* Hover effect for better user experience */
#marks-table tbody tr:hover {
    background-color: rgba(0, 212, 255, 0.05);
}

.no-marks-text {
    text-align: center;
    font-style: italic;
    color: #8a9cb0;
    padding: 40px 0;
}

.profile-header {
    text-align: center;
    margin-bottom: 32px; 
}

.profile-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e8ebf0;
    word-break: break-all;
}

.action-footer {
    margin-top: 24px;
    text-align: center;
}

.action-footer .add-mark-btn {
    width: auto;
    padding: 12px 24px;
}

.profile-feedback-panel {
    min-height: 1.2em;
    margin-top: 16px;
    padding: 12px;
    font-size: 0.9rem;
    text-align: left;
    border-radius: 8px;
    word-wrap: break-word;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.profile-feedback-panel.error {
    color: #fca5a5;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
