/* Modern TA Rating System Styles */
:root {
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --secondary-color: #3f37c9;
    --accent-color: #4cc9f0;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #495057;
    --text-color: #212529;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --radius: 8px;
}

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

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin: 0;
    padding: 20px;
    color: var(--text-color);
    transition: var(--transition);
    min-height: 100vh;
    display: block;
    overflow-y: auto;
}

body.centered {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Card Containers */
.login-container, .container {
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    animation: fadeIn 0.5s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

/* Headers */
.header {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 25px 30px;
    position: relative;
    border-radius: var(--radius) var(--radius) 0 0;
}

.login-container h1 {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: var(--white);
    margin: 0;
    padding: 25px 30px;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 1.6rem;
    text-align: center;
}

.header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    text-align: left;
}

.content {
    padding: 30px;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    margin-top: 12px;
}

#userDisplayName, 
#userDisplayName2, 
#userDisplayName3 {
    flex-grow: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    background-color: rgba(0, 0, 0, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-gray);
    font-weight: 500;
    font-size: 0.95rem;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--medium-gray);
    border-radius: calc(var(--radius) / 2);
    font-size: 16px;
    color: var(--text-color);
    background-color: var(--white);
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: calc(var(--radius) / 2);
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.primary-btn {
    width: 100%;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 14px;
    font-weight: 600;
}

.logout-btn, .back-btn {
    width: auto;
    padding: 6px 14px;
    font-size: 14px;
    margin-left: 10px;
    border-radius: 20px;
    font-weight: 500;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.back-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 6px 14px 6px 10px;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.back-btn::before {
    content: "←";
    margin-right: 6px;
    font-size: 16px;
    font-weight: 700;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}

/* Error Messages */
.error-message {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 6px;
    display: none;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.input-error {
    border-color: var(--danger-color);
}

/* Rating group error highlighting */
#ratingForm .rating-group.error {
    border: 3px solid #f44336 !important;
    background-color: rgba(220, 53, 69, 0.2) !important;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translateX(0);
}

/* Form group error highlighting for textarea */
#ratingForm .form-group.error textarea {
    border-color: #f44336 !important;
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* Rating Specific Styles */
.rating-group {
    margin-bottom: 28px;
    padding: 16px;
    background-color: var(--light-gray);
    border-radius: var(--radius);
    transition: var(--transition);
}

.rating-group:hover {
    background-color: var(--medium-gray);
}

.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    margin-top: 10px;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    font-size: 32px;
    line-height: 40px;
    text-align: center;
    color: #ddd;
    transition: color 0.2s ease-in-out;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #ffb400;
    transform: scale(1.1);
}

#selectedTAName {
    margin-top: 0;
    margin-bottom: 24px;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--light-gray);
}

/* Existing Ratings Container */
#existingRatingsContainer {
    background-color: var(--light-gray);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
    animation: fadeIn 0.5s ease;
}

#existingRatingsContainer h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--medium-gray);
}

/* Confirmation Screen Styles */
.success-message {
    text-align: center;
    padding: 30px 0;
}

.checkmark {
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    display: block;
}

.checkmark-circle {
    stroke: var(--primary-color);
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    stroke: var(--primary-color);
    stroke-width: 2;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

.success-message h2 {
    color: var(--success-color);
    margin-bottom: 10px;
    font-size: 1.6rem;
}

.success-message p {
    color: var(--dark-gray);
    font-size: 1.1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.spinner-container p {
    margin-top: 15px;
    color: var(--dark-gray);
    font-weight: 500;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(67, 97, 238, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Animations */
@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

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

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }
    30%, 50%, 70% {
        transform: translate3d(-2px, 0, 0);
    }
    40%, 60% {
        transform: translate3d(2px, 0, 0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container, .login-container {
        width: 95%;
        max-width: none;
    }
    
    body {
        height: auto;
        padding: 15px;
    }
    
    .header {
        padding: 20px;
    }
    
    .content {
        padding: 20px;
    }
    
    .star-rating label {
        width: 30px;
        height: 30px;
        font-size: 24px;
        line-height: 30px;
    }
}

/* Dashboard styles */
.dashboard-page {
    display: none;
    width: 100%;
    min-height: 100vh;
    background-color: var(--light-gray);
}

.dashboard-header {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 20px 30px;
    box-shadow: var(--shadow);
}

.dashboard-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 90%;
    max-width: 500px;
    max-height: 90%;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--medium-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--light-gray);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
}

.close {
    color: var(--dark-gray);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--medium-gray);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Review Management Styles */
.review-item {
    background-color: var(--light-gray);
    border: 1px solid var(--medium-gray);
    border-radius: var(--radius);
    padding: 15px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.review-item:hover {
    background-color: #f0f0f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.review-period {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1em;
}

.review-info {
    color: var(--dark-gray);
    font-size: 0.9em;
    margin-top: 5px;
}

.review-period-display {
    background-color: #f0f8ff;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-weight: bold;
    text-align: center;
}

/* Secondary Button */
.secondary-btn, .btn-secondary {
    background-color: var(--medium-gray);
    color: var(--dark-gray);
    border: 1px solid var(--dark-gray);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.secondary-btn:hover, .btn-secondary:hover {
    background-color: var(--dark-gray);
    color: var(--white);
}

/* Date Input Styles */
input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--medium-gray);
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    background-color: var(--white);
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

/* Error message specific to date range */
#dateRangeError {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 10px;
    padding: 8px;
    background-color: #ffeaea;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    display: none;
}

/* Rating Controls Styles */
#ratingControls {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 20px !important;
    padding: 15px !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-radius: 8px !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

/* Date Range Dropdown Button */
#ratingControls .secondary-btn {
    background: linear-gradient(135deg, #495057 0%, #6c757d 100%) !important;
    color: white !important;
    border: none !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    min-width: 180px !important;
    text-align: left !important;
    position: relative !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

#ratingControls .secondary-btn:hover {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Add New Rating Button */
#addNewRatingBtn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    color: white !important;
    border: none !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    width: auto !important;
}

#addNewRatingBtn:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Review Period Display */
.review-period-display {
    margin-bottom: 20px !important;
    padding: 12px 16px !important;
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%) !important;
    border: 2px solid #2196f3 !important;
    border-radius: 8px !important;
    color: #1565c0 !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    text-align: center !important;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.1) !important;
}

/* Compact Button Styles */
.compact-btn {
    padding: 6px 12px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    border-radius: 5px !important;
    min-width: auto !important;
    width: auto !important;
}

/* Dropdown Menu Improvements */
#ratingControls .dropdown-menu {
    background: white !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    z-index: 1050 !important;
    min-width: 200px !important;
    max-height: 300px !important;
    overflow-y: auto !important;
}

#ratingControls .dropdown-menu div {
    padding: 8px 12px !important;
    font-size: 13px !important;
    color: #495057 !important;
    border-bottom: 1px solid #f8f9fa !important;
    transition: background-color 0.2s ease !important;
}

#ratingControls .dropdown-menu div:hover {
    background-color: #f8f9fa !important;
    color: #007bff !important;
}

#ratingControls .dropdown-menu div:last-child {
    border-bottom: none !important;
}

/* Officer Rating Sections */
.ratings-section {
    margin-bottom: 30px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--radius);
    overflow: hidden;
    background-color: var(--white);
}

.section-header {
    background-color: var(--light-gray);
    padding: 15px 20px;
    border-bottom: 1px solid var(--medium-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h3 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.2em;
    font-weight: 500;
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-display {
    padding: 20px;
    min-height: 50px;
}

.rating-display:empty::before {
    content: "No ratings available for this section";
    color: var(--dark-gray);
    font-style: italic;
    opacity: 0.7;
}

/* Section-specific styling */
#mentorRatingsSection .section-header {
    background-color: rgba(76, 201, 240, 0.1);
    border-bottom-color: rgba(76, 201, 240, 0.3);
}

#mentorRatingsSection .section-header h3 {
    color: var(--accent-color);
}

#mentorRatingsSection .section-header h3::after {
    content: " (View Only)";
    font-size: 0.8em;
    font-weight: normal;
    color: #666;
    font-style: italic;
}

#officerRatingsSection .section-header {
    background-color: rgba(67, 97, 238, 0.1);
    border-bottom-color: rgba(67, 97, 238, 0.3);
}

#officerRatingsSection .section-header h3 {
    color: var(--primary-color);
}