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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #f5f5f5;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: #2c3e50;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  flex-wrap: wrap;
  gap: 1rem;
}

.header .brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.header .brand img {
  height: 32px;
  max-width: 200px;
  object-fit: contain;
  transition: height 0.3s;
}

.header h1 {
  font-size: 1.5rem;
}

.user-info {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.user-info #clients-link,
.user-info #tutors-link,
.user-info #settings-link {
  display: none;
}

.role-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.role-admin { background: #e74c3c; }
.role-tutor { background: #3498db; }
.role-volunteer { background: #2ecc71; }

/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: white;
  padding: 2.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.login-box h2 {
  margin-bottom: 1.5rem;
  color: #2c3e50;
  text-align: center;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #555;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: #667eea;
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #5568d3;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.btn-icon img {
  width: 18px;
  height: 18px;
  display: block;
}

.btn-icon.active {
  background: #7f8c8d;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-success {
  background: #2ecc71;
  color: white;
}

.btn-success:hover {
  background: #27ae60;
}

/* Dashboard */
.dashboard {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.dashboard-header h2 {
  color: #2c3e50;
}

/* Files */
.upload-section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.upload-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.file-list {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Client search input */
#client-search {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#client-search:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#client-search::placeholder {
  color: #999;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

.file-item:last-child {
  border-bottom: none;
}

.file-info {
  flex: 1;
}

.file-info h4 {
  color: #2c3e50;
  margin-bottom: 0.25rem;
}

.file-meta {
  font-size: 0.85rem;
  color: #7f8c8d;
}

.file-actions {
  display: flex;
  gap: 0.5rem;
}

.file-actions .btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Error/Success messages */
.error-message {
  background: #e74c3c;
  color: white;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.success-message {
  background: #2ecc71;
  color: white;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.info-box {
  background: #ecf0f1;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border-left: 4px solid #3498db;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: #7f8c8d;
}

/* Uniform header buttons */
.header .btn,
.header .user-info a,
.header button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
}

.header .btn:hover,
.header .user-info a:hover,
.header button:hover {
  background: #f1f5f9;
}

.header .btn.active,
.header .user-info a.active {
  border-color: #94a3b8;
  background: #eef2ff;
}

.header .btn.btn-secondary,
.header .user-info a.btn.btn-secondary,
.header button.btn.btn-secondary {
  background: #ffffff;
}

.header .btn.btn-icon,
.header .user-info a.btn.btn-icon,
.header button.btn.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
}

.header .btn.btn-icon img,
.header .user-info a.btn.btn-icon img,
.header button.btn.btn-icon img {
  height: 18px;
  width: 18px;
  display: block;
}

.header .btn.btn-success,
.header .user-info a.btn.btn-success,
.header button.btn.btn-success {
  background: #10b981;
  color: #ffffff;
  border-color: #0ea5e9;
}

.header .role-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 12px;
}

/* User name in header */
.user-info > span:not(.role-badge) {
  font-size: 14px;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }
  
  .header .brand img {
    height: 28px;
  }
  
  .user-info {
    gap: 0.5rem;
  }
  
  .user-info > span:not(.role-badge) {
    display: none;
  }
  
  .header .btn,
  .header .user-info a,
  .header button {
    height: 28px;
    padding: 4px 8px;
    font-size: 13px;
  }
  
  .header .btn.btn-icon,
  .header .user-info a.btn.btn-icon,
  .header button.btn.btn-icon {
    width: 28px;
    height: 28px;
  }
  
  .header .role-badge {
    height: 22px;
    padding: 0 6px;
    font-size: 11px;
  }
  
  .upload-form {
    flex-direction: column;
  }
  
  .file-item {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  .file-actions {
    width: 100%;
  }
  
  .file-actions .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.5rem;
  }
  
  .header .brand img {
    height: 24px;
    max-width: 150px;
  }
  
  .dashboard {
    padding: 1rem;
  }
  
  .dashboard-header h2 {
    font-size: 1.25rem;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: white;
  padding: 0;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  background: linear-gradient(to bottom, #f8f9fa, #ffffff);
}

.modal-header h4 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #2c3e50;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(85vh - 140px);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fa;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal-body label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #555;
  font-size: 0.9rem;
}

.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-body input[type="text"]:focus,
.modal-body input[type="email"]:focus,
.modal-body input[type="password"]:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.modal-body .form-group {
  margin-bottom: 1rem;
}

.modal-body .checkbox-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.75rem;
  background: #fafafa;
}

.modal-body .checkbox-list label,
.modal-body .radio-list label {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  margin: 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
  font-weight: normal;
}

.modal-body .checkbox-list label:hover,
.modal-body .radio-list label:hover {
  background: #e8f4f8;
}

.modal-body .checkbox-list input[type="checkbox"],
.modal-body .radio-list input[type="radio"] {
  margin-right: 0.75rem;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.modal-body .radio-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.5rem;
  background: #fafafa;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(3px);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: white;
  margin-top: 1.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
}

.loading-text small {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
