/* Kelaniya Paper Upload System - Custom CSS */

/* Root Variables */
:root {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --info-color: #0dcaf0;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  --font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Body and General Styles */
body {
  font-family: var(--font-family);
  background-color: #f4f6f9;
  line-height: 1.6;
}

/* Navigation Enhancements */
.navbar-brand {
  font-weight: 700;
  font-size: 1.4rem;
}

.navbar-brand i {
  margin-right: 8px;
  color: #ffd700;
}

.navbar-nav .nav-link {
  font-weight: 500;
  transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
  color: #ffd700 !important;
}

.navbar-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

/* Card Enhancements */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 1.5rem;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.12);
}

.card-header {
  border-radius: 12px 12px 0 0 !important;
  font-weight: 600;
  padding: 1rem 1.25rem;
}

.card-header h4,
.card-header h5 {
  margin: 0;
}

.card-header i {
  margin-right: 8px;
}

/* Button Enhancements */
.btn {
  border-radius: 8px;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn i {
  margin-right: 5px;
}

.btn-primary {
  background: linear-gradient(135deg, #0d6efd, #0b5ed7);
  border: none;
}

.btn-success {
  background: linear-gradient(135deg, #198754, #157347);
  border: none;
}

.btn-warning {
  background: linear-gradient(135deg, #ffc107, #ffca2c);
  border: none;
  color: #000;
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545, #bb2d3b);
  border: none;
}

.btn-info {
  background: linear-gradient(135deg, #0dcaf0, #3dd5f3);
  border: none;
  color: #000;
}

/* Form Enhancements */
.form-control,
.form-select {
  border-radius: 8px;
  border: 2px solid #e9ecef;
  padding: 0.625rem 0.75rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1);
}

.form-label {
  font-weight: 600;
  color: var(--dark-color);
  margin-bottom: 0.5rem;
}

/* Table Enhancements */
.table {
  border-radius: 8px;
  overflow: hidden;
}

.table th {
  background-color: #f8f9fa;
  font-weight: 600;
  border: none;
  padding: 1rem 0.75rem;
  color: var(--dark-color);
}

.table td {
  padding: 1rem 0.75rem;
  border-color: #f1f3f4;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Badge Enhancements */
.badge {
  padding: 0.5em 0.75em;
  border-radius: 6px;
  font-weight: 500;
}

/* Alert Enhancements */
.alert {
  border: none;
  border-radius: 10px;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.alert-success {
  background: linear-gradient(135deg, #d1edff, #a7d9f7);
  color: #0c5460;
}

.alert-danger {
  background: linear-gradient(135deg, #f8d7da, #f1aeb5);
  color: #721c24;
}

.alert-warning {
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  color: #856404;
}

.alert-info {
  background: linear-gradient(135deg, #d1ecf1, #abdde5);
  color: #0c5460;
}

/* Statistics Cards */
.stats-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 15px;
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.stats-card h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
}

.stats-card h5 {
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

/* Welcome Section */
.welcome-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 15px;
}

.welcome-card h2 {
  font-weight: 700;
}

/* File Upload Styling */
.file-upload-area {
  border: 3px dashed #dee2e6;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  transition: border-color 0.3s ease;
  background-color: #f8f9fa;
}

.file-upload-area:hover {
  border-color: var(--primary-color);
  background-color: rgba(13, 110, 253, 0.05);
}

.file-upload-area.dragover {
  border-color: var(--success-color);
  background-color: rgba(25, 135, 84, 0.05);
}

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Status Badges */
.status-pending {
  background-color: #ffc107;
  color: #000;
}

.status-approved {
  background-color: #198754;
  color: #fff;
}

.status-rejected {
  background-color: #dc3545;
  color: #fff;
}

/* Paper Item Cards */
.paper-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.paper-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.paper-title {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.paper-meta {
  color: var(--secondary-color);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.paper-description {
  color: var(--dark-color);
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  .card-body {
    padding: 1rem;
  }

  .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
  }

  .table-responsive {
    font-size: 0.875rem;
  }

  .navbar-brand {
    font-size: 1.2rem;
  }
}

@media (max-width: 576px) {
  .stats-card h2 {
    font-size: 2rem;
  }

  .welcome-card h2 {
    font-size: 1.5rem;
  }

  .card-header h4 {
    font-size: 1.2rem;
  }
}

/* Login/Register Page Styling */
.auth-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.auth-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  padding: 2rem;
}

.auth-body {
  padding: 2rem;
}

/* Footer Styling */
.footer {
  background-color: var(--dark-color);
  color: var(--light-color);
  padding: 2rem 0;
  margin-top: 4rem;
}

/* Utility Classes */
.text-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-soft {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07) !important;
}

.shadow-medium {
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.12) !important;
}

.rounded-lg {
  border-radius: 12px !important;
}

.border-soft {
  border: 2px solid #e9ecef !important;
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Public Paper Browse Styling */
.hover-shadow {
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.hover-shadow:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-3px);
}

.public-paper-card {
    border-left: 4px solid var(--primary-color);
    transition: border-color 0.3s ease;
}

.public-paper-card:hover {
    border-left-color: var(--success-color);
}

/* Public Access Badge */
.badge.bg-light.text-dark {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
    border: 1px solid #dee2e6;
}

/* Action Buttons Styling */
.btn-group .btn {
    white-space: nowrap;
    min-width: auto;
}

.btn-group .btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-group .btn i {
    margin-right: 4px;
}

/* Table Actions Column */
.table td:last-child {
    min-width: 180px;
    white-space: nowrap;
}

.table .btn-group {
    display: flex;
    gap: 4px;
}

/* Enhanced Button Visibility */
.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-color: #28a745;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
    transform: translateY(-1px);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    border-color: #17a2b8;
    box-shadow: 0 2px 4px rgba(23, 162, 184, 0.2);
    color: #fff;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
    transform: translateY(-1px);
    color: #fff;
}

/* Action Button Improvements */
.btn-group .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-group .btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
    border: none;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-group .btn:not(:last-child) {
    margin-right: 6px;
}

/* Hover effects for better visual feedback */
.btn-group .btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-group .btn-info:hover {
    background: linear-gradient(135deg, #138496 0%, #5a32a3 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

/* Mobile Responsive Action Buttons */
@media (max-width: 768px) {
    .table .btn-group {
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
    }
    
    .table .btn-group .btn {
        width: 100%;
        text-align: center;
        margin-right: 0 !important;
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }
    
    .table td:last-child {
        min-width: 110px;
        padding: 0.75rem 0.5rem;
    }
    
}

/* Ensure proper spacing for button text */
.btn i + span {
    margin-left: 4px;
}

/* Button focus states for accessibility */
.btn-group .btn:focus {
    outline: 2px solid rgba(0, 123, 255, 0.5);
    outline-offset: 2px;
}

/* Additional styling for action buttons visibility */
.btn-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 6px;
    overflow: hidden;
}

/* Ensure buttons are never too small */
.btn-sm {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* New Grade/Subject Fields Styling */
#new_grade_fields, #new_subject_fields {
    background: rgba(13, 110, 253, 0.05);
    border: 1px dashed #0d6efd;
    border-radius: 8px;
    padding: 15px;
    animation: slideDown 0.3s ease-out;
}

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

/* Highlight "Add New" options in dropdowns */
option[value="0"] {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

/* Style for new field labels */
#new_grade_fields .form-label,
#new_subject_fields .form-label {
    color: #0d6efd;
    font-weight: 600;
    margin-bottom: 5px;
}

/* New field input styling */
#new_grade_fields .form-control,
#new_subject_fields .form-control {
    border: 2px solid #0d6efd;
    background-color: #fff;
}

#new_grade_fields .form-control:focus,
#new_subject_fields .form-control:focus {
    border-color: #0b5ed7;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Index Page Button Improvements */
.hero-buttons .btn {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    min-width: 150px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-buttons .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.hero-buttons .btn-light {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border: 2px solid #fff;
    color: #0d6efd;
}

.hero-buttons .btn-light:hover {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #0b5ed7;
    border-color: #f8f9fa;
}

.hero-buttons .btn-outline-light {
    border: 2px solid #fff;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.hero-buttons .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    color: #fff;
}

/* Paper Card Action Buttons */
.paper-card-actions .btn {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    min-width: 70px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.paper-card-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.paper-card-actions .btn-outline-info {
    border: 2px solid #0dcaf0;
    background: rgba(13, 202, 240, 0.1);
}

.paper-card-actions .btn-outline-info:hover {
    background: #0dcaf0;
    border-color: #0dcaf0;
    color: #fff;
}

.paper-card-actions .btn-success {
    background: linear-gradient(135deg, #198754, #20c997);
    border: none;
}

.paper-card-actions .btn-success:hover {
    background: linear-gradient(135deg, #157347, #1a8870);
}

/* Search Form Buttons */
.search-form-buttons .btn {
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    border-radius: 25px;
    min-width: 120px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-form-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.search-form-buttons .btn-primary {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    border: none;
}

.search-form-buttons .btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    border: none;
}

.search-form-buttons .btn-success {
    background: linear-gradient(135deg, #198754, #20c997);
    border: none;
}

.search-form-buttons .btn-info {
    background: linear-gradient(135deg, #0dcaf0, #6f42c1);
    border: none;
}

/* Call to Action Buttons */
.cta-section .btn {
    padding: 0.75rem 2rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 30px;
    min-width: 140px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.cta-section .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Footer Buttons */
footer .text-white {
    transition: all 0.2s ease;
}

footer .text-white:hover {
    color: #ffc107 !important;
    text-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
}

/* Search Button in Input Group */
.input-group .btn-primary {
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    border: none;
    box-shadow: 0 2px 10px rgba(13, 110, 253, 0.3);
    transition: all 0.3s ease;
}

.input-group .btn-primary:hover {
    background: linear-gradient(135deg, #0b5ed7, #5a0fc8);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
}

/* Enhanced Card Hover Effects for Index Page */
.hover-shadow {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.hover-shadow:hover {
    border-color: #0d6efd;
    box-shadow: 0 8px 30px rgba(13, 110, 253, 0.15) !important;
    transform: translateY(-5px);
}

/* Paper Card Title Hover Effect */
.card-title.text-primary {
    transition: color 0.2s ease;
}

.hover-shadow:hover .card-title.text-primary {
    color: #0b5ed7 !important;
}

/* Statistics Display Enhancements */
.display-6 {
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.text-warning {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Badge Enhancements */
.badge {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Section Separation for Index Page */
.browse-papers-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 3px solid #e9ecef;
    position: relative;
}

.browse-papers-section::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    border-radius: 2px;
}

.features-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Enhanced Section Headers */
.section-header {
    position: relative;
    padding-bottom: 1rem;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    border-radius: 2px;
}

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

/* Mobile Responsive Button Improvements */
@media (max-width: 768px) {
    .hero-buttons .btn {
        font-size: 1rem;
        padding: 0.6rem 1.5rem;
        min-width: 130px;
        margin-bottom: 0.5rem;
    }
    
    .paper-card-actions {
        gap: 5px;
    }
    
    .paper-card-actions .btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
        min-width: 60px;
    }
    
    .search-form-buttons .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
        min-width: 100px;
        margin-bottom: 0.5rem;
    }
    
    .input-group .btn-primary {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}
