/* ============================================
   PreviousYear.in - Main Stylesheet
   ============================================ */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #f9fafb;
  --white: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* ============================================
   HEADER
   ============================================ */
.site-header { background: var(--white); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }

.top-bar {
  background: var(--primary-dark);
  color: var(--white);
  padding: 8px 0;
  font-size: 13px;
}
.top-bar .container { display: flex; justify-content: space-between; align-items: center; }
.top-links a { color: var(--white); margin-left: 15px; font-size: 13px; }
.top-links a:hover { color: var(--secondary); }

.main-header .container {
  display: flex; align-items: center; padding: 15px;
  gap: 20px;
}
.logo-text { font-size: 24px; font-weight: 700; color: var(--primary); }
.logo img { max-height: 50px; }

.search-form {
  flex: 1; display: flex; max-width: 600px;
  border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.search-form input { flex: 1; padding: 10px 15px; border: 0; outline: 0; font-size: 15px; }
.search-form button {
  background: var(--primary); color: var(--white); border: 0;
  padding: 0 20px; cursor: pointer; font-size: 16px;
}

.mobile-menu-toggle { display: none; background: 0; border: 0; font-size: 24px; cursor: pointer; }

.main-nav { background: var(--primary); color: var(--white); }
.main-nav ul { list-style: none; display: flex; flex-wrap: wrap; }
.main-nav ul li { position: relative; }
.main-nav ul li a {
  color: var(--white); padding: 12px 18px; display: block;
  font-weight: 500; font-size: 14px; transition: background .2s;
}
.main-nav ul li a:hover { background: var(--primary-dark); color: var(--white); }
.main-nav .has-dropdown:hover .dropdown { display: block; }
.main-nav .dropdown {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--white); min-width: 220px; box-shadow: var(--shadow-md);
  flex-direction: column; z-index: 100;
}
.main-nav .dropdown li { width: 100%; }
.main-nav .dropdown li a { color: var(--text); padding: 10px 15px; }
.main-nav .dropdown li a:hover { background: var(--bg); color: var(--primary); }

/* ============================================
   FLASH MESSAGES
   ============================================ */
.flash-msg { padding: 12px 0; color: var(--white); }
.flash-success { background: var(--success); }
.flash-error { background: var(--danger); }
.flash-warning { background: var(--warning); }

/* ============================================
   HERO / SECTIONS
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white); padding: 60px 0; text-align: center;
}
.hero h1 { font-size: 38px; margin-bottom: 15px; }
.hero p { font-size: 18px; opacity: 0.95; max-width: 700px; margin: 0 auto 25px; }
.hero .search-form { margin: 20px auto; }

.section { padding: 50px 0; }
.section-title {
  font-size: 28px; margin-bottom: 30px; text-align: center;
  position: relative; padding-bottom: 12px;
}
.section-title::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 60px; height: 3px; background: var(--secondary);
}

/* ============================================
   CARDS & GRIDS
   ============================================ */
.cat-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.cat-card {
  background: var(--white); border-radius: var(--radius); padding: 25px;
  text-align: center; box-shadow: var(--shadow); transition: all .3s;
  display: block; color: var(--text);
}
.cat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); color: var(--primary); }
.cat-card i { font-size: 36px; color: var(--primary); margin-bottom: 12px; }
.cat-card h3 { font-size: 17px; margin-bottom: 8px; }
.cat-card p { font-size: 13px; color: var(--text-light); }

.material-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.material-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: all .3s;
}
.material-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.material-card .card-body { padding: 18px; }
.material-card .badge {
  display: inline-block; background: var(--primary); color: var(--white);
  padding: 3px 10px; border-radius: 20px; font-size: 11px;
  text-transform: uppercase; margin-bottom: 8px;
}
.material-card h3 { font-size: 16px; margin-bottom: 10px; line-height: 1.3; }
.material-card h3 a { color: var(--text); }
.material-card .meta { font-size: 12px; color: var(--text-light); display: flex; gap: 12px; margin-bottom: 10px; }
.material-card .actions { display: flex; gap: 8px; margin-top: 12px; }

/* ============================================
   BUTTONS & FORMS
   ============================================ */
.btn {
  display: inline-block; padding: 10px 20px;
  background: var(--primary); color: var(--white) !important;
  border: 0; border-radius: var(--radius); cursor: pointer;
  font-size: 14px; font-weight: 500; text-decoration: none;
  transition: background .2s;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; outline: 0;
  transition: border-color .2s;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 100px; }

.auth-box {
  max-width: 450px; margin: 50px auto; background: var(--white);
  padding: 35px; border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.auth-box h2 { margin-bottom: 20px; text-align: center; }

/* ============================================
   MATERIAL DETAIL PAGE
   ============================================ */
.breadcrumb {
  padding: 12px 0; font-size: 13px; color: var(--text-light);
}
.breadcrumb a { color: var(--primary); }
.breadcrumb span { margin: 0 8px; }

.content-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 30px; padding: 30px 0; }
@media (max-width: 900px) { .content-wrap { grid-template-columns: 1fr; } }

.main-content {
  background: var(--white); padding: 30px; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.main-content h1 { font-size: 26px; margin-bottom: 15px; }
.material-info {
  display: flex; flex-wrap: wrap; gap: 15px;
  background: var(--bg); padding: 15px; border-radius: var(--radius);
  margin: 20px 0;
}
.material-info span { font-size: 13px; }
.material-info i { color: var(--primary); margin-right: 5px; }

.sidebar {
  background: var(--white); padding: 20px; border-radius: var(--radius);
  box-shadow: var(--shadow); align-self: start;
}
.sidebar h3 { font-size: 16px; margin-bottom: 15px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }

/* ============================================
   FOOTER
   ============================================ */
.site-footer { background: #1f2937; color: #d1d5db; padding: 50px 0 0; margin-top: 60px; }
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px; padding-bottom: 30px;
}
.footer-col h4 { color: var(--white); margin-bottom: 15px; font-size: 16px; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col a { color: #d1d5db; font-size: 14px; }
.footer-col a:hover { color: var(--secondary); }
.social-links { margin-top: 15px; }
.social-links a {
  display: inline-block; width: 36px; height: 36px;
  background: rgba(255,255,255,0.1); border-radius: 50%;
  text-align: center; line-height: 36px; margin-right: 8px; color: var(--white);
}
.social-links a:hover { background: var(--secondary); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 20px 0; text-align: center; font-size: 13px; }

/* ============================================
   PAGINATION
   ============================================ */
.pagination-wrap { margin: 30px 0; text-align: center; }
.pagination { display: inline-flex; gap: 5px; list-style: none; }
.pagination a {
  padding: 8px 14px; border: 1px solid var(--border);
  background: var(--white); border-radius: var(--radius);
  color: var(--text); font-size: 14px;
}
.pagination .active a, .pagination a:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ============================================
   BACK TO TOP
   ============================================ */
.back-to-top {
  position: fixed; bottom: 25px; right: 25px;
  width: 45px; height: 45px; background: var(--primary);
  color: var(--white) !important; border-radius: 50%;
  text-align: center; line-height: 45px; box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transition: all .3s;
}
.back-to-top.show { opacity: 1; visibility: visible; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .top-bar .container { flex-direction: column; gap: 5px; text-align: center; }
  .main-header .container { flex-wrap: wrap; }
  .search-form { order: 3; flex-basis: 100%; margin-top: 10px; }
  .mobile-menu-toggle { display: block; }
  .main-nav ul { display: none; flex-direction: column; }
  .main-nav.open ul { display: flex; }
  .main-nav .dropdown { position: static; box-shadow: none; }
  .hero h1 { font-size: 28px; }
}

/* ============================================
   ADMIN PANEL STYLES
   ============================================ */
.admin-wrap { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-sidebar { background: #1e293b; color: #cbd5e1; padding: 20px 0; }
.admin-sidebar h2 { color: var(--white); padding: 0 20px 20px; font-size: 18px; }
.admin-sidebar ul { list-style: none; }
.admin-sidebar a {
  display: block; color: #cbd5e1; padding: 12px 20px; font-size: 14px;
  border-left: 3px solid transparent;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  background: rgba(255,255,255,0.05); color: var(--white); border-left-color: var(--primary);
}
.admin-sidebar i { width: 20px; text-align: center; margin-right: 8px; }

.admin-main { padding: 25px; background: var(--bg); }
.admin-header {
  background: var(--white); padding: 15px 25px; border-radius: var(--radius);
  margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow);
}
.admin-card {
  background: var(--white); padding: 25px; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.admin-card h2 { font-size: 18px; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 25px;
}
.stat-box {
  background: var(--white); padding: 20px; border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 15px;
}
.stat-icon {
  width: 50px; height: 50px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: rgba(37,99,235,0.1); color: var(--primary);
}
.stat-info h3 { font-size: 24px; margin-bottom: 0; }
.stat-info p { font-size: 13px; color: var(--text-light); margin: 0; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px;
}
.data-table th { background: var(--bg); font-weight: 600; }
.data-table tr:hover { background: var(--bg); }

.status-badge {
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; display: inline-block;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }

@media (max-width: 768px) {
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-sidebar { position: fixed; left: -240px; top: 0; height: 100%; width: 240px; transition: left .3s; z-index: 200; }
  .admin-sidebar.open { left: 0; }
}
