/**
 * student-card.css - Redesigned Student Card Layout
 * Improved organization and layout for student tracking
 */

/* Main student card container */
.student-card {
    background-color: var(--color-cardBg);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-small);
    margin-bottom: var(--spacing-md);
    padding: 0.75rem;
    transition: var(--transition-medium);
    border-left: 4px solid transparent;
    position: relative;
}

.student-card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

/* Student header with name and points */
.student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

/* Student name container */
.student-name-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

/* Student name */
.student-name {
    font-weight: 600;
    font-size: 1rem;
}

/* Helper badge styling */
.helper-badge-inline {
    background-color: gold;
    color: black;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    white-space: nowrap;
}

/* Point totals styling */
.point-totals {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
    text-align: right;
}

.positive-points {
    color: var(--color-secondary);
    font-weight: 600;
}

.negative-points {
    color: var(--color-danger);
    font-weight: 600;
}

/* Attendance group (contains all attendance controls) */
.attendance-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    width: 100%;
}

/* Attendance controls container */
.attendance-controls {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.25rem;
    width: 100%;
}

/* Attendance buttons row (first 5 columns) */
.attendance-buttons {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: span 5;
    gap: 0.25rem;
}

/* Attendance actions column (last column) */
.attendance-actions {
    display: flex;
    flex-direction: column;
    grid-column: 6;
    gap: 0.25rem;
    height: 100%;
}

/* All button styling in attendance */
.attendance-btn, .attendance-help-btn, .notes-toggle-btn {
    border-radius: 4px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Attendance status buttons */
.attendance-btn {
    height: 40px;
    font-size: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    opacity: 0.7; /* Semi-transparent by default */
    transition: all 0.2s ease, opacity 0.15s ease;
}

.attendance-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    opacity: 1; /* Full opacity on hover */
}

.attendance-btn.selected {
    border: 2px solid #fff !important;
    box-shadow: 0 0 0 2px #000 !important;
    transform: translateY(-2px);
    opacity: 1; /* Full opacity when selected */
}

/* Status-specific button styles */
.attendance-btn-P, .attendance-btn-PRESENT {
    background-color: var(--color-statusPresent) !important;
    color: white !important;
}

.attendance-btn-A, .attendance-btn-ABSENT {
    background-color: var(--color-statusAbsent) !important;
    color: white !important;
}

.attendance-btn-T, .attendance-btn-TARDY {
    background-color: var(--color-statusTardy) !important;
    color: black !important;
}

.attendance-btn-E, .attendance-btn-EARLY_LEAV {
    background-color: var(--color-statusEarly) !important;
    color: white !important;
}

.attendance-btn-S, .attendance-btn-SICK {
    background-color: var(--color-statusSick) !important;
    color: white !important;
}

/* Help button */
.attendance-help-btn {
    height: 19px;
    background-color: var(--color-gray);
    color: white;
    font-size: 14px;
    border-radius: 4px; /* Ensure consistent shape across all display modes */
}

.attendance-help-btn:hover {
    background-color: var(--color-dark);
}

/* Notes toggle button */
.notes-toggle-btn {
    height: 19px;
    background-color: #f0f0f0;
    color: #555;
    border: 1px solid #ddd;
}

.notes-toggle-btn .material-icons {
    font-size: 16px;
}

.notes-toggle-btn:hover {
    background-color: #e0e0e0;
}

/* Notes container */
.notes-container {
    width: 100%;
    margin-top: 0.25rem;
}

/* Notes input field */
.attendance-notes {
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    display: none;
}

/* Show notes when visible class is added */
.attendance-notes.visible {
    display: block;
}

/* Student actions (buttons below attendance) */
.student-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Status-specific student card styling */
.student-card[data-status="P"] {
    border-left-color: var(--color-statusPresent);
}

.student-card[data-status="A"] {
    border-left-color: var(--color-statusAbsent);
}

.student-card[data-status="T"] {
    border-left-color: var(--color-statusTardy);
}

.student-card[data-status="E"] {
    border-left-color: var(--color-statusEarly);
}

.student-card[data-status="S"] {
    border-left-color: var(--color-statusSick);
}

/* Attendance Buttons Styles - Consolidated from attendance.css */
.attendance-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

/* Toggle button */
.attendance-toggle-btn {
    padding: 0.25rem 0.5rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Legend in help modal */
.attendance-legend {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

/* Book controls */
.book-controls {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    background-color: var(--color-light);
    padding: var(--spacing-sm);
    border-radius: var(--radius-small);
}

.book-controls label {
    font-weight: 500;
    font-size: var(--font-size-small);
    color: var(--color-textSecondary);
}

.book-buttons {
    display: flex;
    gap: 0.3rem;
}

.book-btn {
    padding: 0.3rem 0.6rem;
    font-weight: bold;
    min-width: 40px;
    height: 40px;
    border-radius: var(--radius-small);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    flex: 1;
}

.book-btn.active {
    transform: scale(0.95);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--color-dark);
}

/* Mobile optimizations */
@media (max-width: 576px) {
    .student-card {
        padding: 0.5rem;
    }
    
    .attendance-btn {
        height: 36px;
        font-size: 0.9rem;
    }
    
    .attendance-help-btn,
    .notes-toggle-btn {
        height: 17px;
    }
    
    .attendance-controls {
        gap: 0.2rem;
    }
}

/* Additional CSS Fixes for Mobile Display */

/* Fix for help button in symbols mode */
body.symbols-mode .attendance-help-btn {
    border-radius: 4px !important; /* Force rectangular shape in symbols mode */
  }
  
  /* Ensure consistent styling regardless of display mode */
  .attendance-help-btn,
  .notes-toggle-btn {
    border-radius: 4px !important; /* Always rectangular */
    -webkit-appearance: none; /* Prevent iOS from adding default styling */
    -moz-appearance: none;
    appearance: none;
  }
  
  /* Make sure buttons are visible enough when semi-transparent */
  .attendance-btn {
    opacity: 0.4; /* Slightly more visible but still distinct from selected */
    -webkit-tap-highlight-color: transparent; /* Prevent tap highlight on mobile */
  }
  
  /* Improve tap targets on mobile */
  @media (max-width: 576px) {
    .attendance-help-btn,
    .notes-toggle-btn {
      min-height: 16px; /* Ensure minimum tap target size */
    }
    
    /* Fix for iOS button rendering issues */
    button {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
    }
    
    /* Increase contrast in attendance buttons for better visibility on mobile */
    .attendance-btn {
      min-height: 36px;
      opacity: 0.4;
      font-weight: bold;
    }
    
    /* Ensure the help button is more clearly visible */
    .attendance-help-btn {
      font-weight: bold;
    }
  }
  
  /* Fix for Safari inconsistencies */
  @supports (-webkit-touch-callout: none) {
    .attendance-btn,
    .attendance-help-btn,
    .notes-toggle-btn {
      border-radius: 4px !important;
    }
  }
  
  /* Make selected state more prominent on mobile */
  @media (max-width: 576px) {
    .attendance-btn.selected {
      transform: translateY(-1px); /* Less dramatic transform on small screens */
      opacity: 1;
      border: 3px solid #fff !important; /* Thicker border for better visibility */
      box-shadow: 0 0 0 2px #000 !important;
    }
  }