/* 
 * MailMaster - Advanced Email System
 * Main Stylesheet
 */

/* ===== Variables ===== */
:root {
  --primary-color: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --secondary-color: #10b981;
  --secondary-dark: #059669;
  --secondary-light: #34d399;
  --dark-color: #1f2937;
  --light-color: #f9fafb;
  --gray-color: #6b7280;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --success-color: #10b981;

  --body-bg: #f3f4f6;
  --card-bg: #ffffff;
  --header-height: 70px;
  --footer-bg: #1f2937;
  --footer-text: #d1d5db;

  --border-radius: 8px;
  --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s ease;
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
  background-color: var(--body-bg);
  color: var(--dark-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: var(--primary-color);
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

/* ===== Preloader ===== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--card-bg);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.spinner {
  width: 70px;
  text-align: center;
}

.spinner > div {
  width: 18px;
  height: 18px;
  background-color: var(--primary-color);
  border-radius: 100%;
  display: inline-block;
  animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.spinner .bounce1 {
  animation-delay: -0.32s;
}

.spinner .bounce2 {
  animation-delay: -0.16s;
}

@keyframes sk-bouncedelay {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1.0);
  }
}

/* ===== Header ===== */
.header {
  background-color: var(--card-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar {
  height: var(--header-height);
  padding: 0;
}

.navbar-brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.logo-icon {
  margin-right: 10px;
  font-size: 1.8rem;
}

.logo-text {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-link {
  color: var(--dark-color);
  font-weight: 500;
  padding: 0.5rem 1rem;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 3px 3px 0 0;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  padding: 2rem 0;
}

/* ===== Cards ===== */
.card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border: none;
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.25rem 1.5rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* ===== Buttons ===== */
.btn {
  border-radius: var(--border-radius);
  padding: 0.5rem 1.5rem;
  font-weight: 500;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
}

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

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background-color: var(--primary-color);
  color: white;
}

/* ===== Forms ===== */
.form-control,
.form-select {
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.25);
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* ===== Sidebar ===== */
.sidebar {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
}

.sidebar-item {
  padding: 0.75rem 1.25rem;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  color: var(--dark-color);
  transition: var(--transition);
}

.sidebar-item:hover,
.sidebar-item.active {
  background-color: rgba(79, 70, 229, 0.1);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.sidebar-item i {
  width: 20px;
  text-align: center;
  margin-right: 10px;
  color: var(--gray-color);
}

.sidebar-item:hover i,
.sidebar-item.active i {
  color: var(--primary-color);
}

/* ===== Email List ===== */
.email-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.email-item {
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.email-item:hover {
  background-color: rgba(79, 70, 229, 0.05);
}

.email-item.unread {
  background-color: rgba(59, 130, 246, 0.05);
}

.email-checkbox {
  margin-right: 1rem;
}

.email-star {
  margin-right: 1rem;
  color: var(--gray-color);
  cursor: pointer;
}

.email-star.active {
  color: var(--warning-color);
}

.email-sender {
  width: 200px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-content {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-subject {
  font-weight: 500;
}

.email-body-preview {
  color: var(--gray-color);
  font-size: 0.875rem;
}

.email-time {
  width: 100px;
  text-align: right;
  color: var(--gray-color);
  font-size: 0.875rem;
}

.email-attachment {
  margin-right: 1rem;
  color: var(--gray-color);
}

/* ===== Dashboard Stats ===== */
.stat-card {
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-card-primary {
  background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
  color: white;
}

.stat-card-secondary {
  background: linear-gradient(45deg, var(--secondary-color), var(--secondary-light));
  color: white;
}

.stat-card-info {
  background: linear-gradient(45deg, var(--info-color), #60a5fa);
  color: white;
}

.stat-card-warning {
  background: linear-gradient(45deg, var(--warning-color), #fbbf24);
  color: white;
}

.stat-card-danger {
  background: linear-gradient(45deg, var(--danger-color), #f87171);
  color: white;
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 1rem;
  opacity: 0.9;
}

.stat-change {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.stat-change i {
  margin-right: 0.25rem;
}

.stat-change.positive {
  color: #a7f3d0;
}

.stat-change.negative {
  color: #fca5a5;
}

/* ===== Animations ===== */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
  animation: slideUp 0.5s ease-in-out;
}

.slide-down {
  animation: slideDown 0.5s ease-in-out;
}

.slide-left {
  animation: slideLeft 0.5s ease-in-out;
}

.slide-right {
  animation: slideRight 0.5s ease-in-out;
}

.pulse {
  animation: pulse 2s infinite;
}

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

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

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

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

@keyframes slideRight {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* ===== Footer ===== */
.footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  padding: 3rem 0 1rem;
  margin-top: 2rem;
}

.footer-heading {
  color: white;
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 0.75rem;
}

.footer-heading::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  border-radius: 3px;
}

.footer-text {
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.social-icons {
  display: flex;
  gap: 1rem;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  transition: var(--transition);
}

.social-icon:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-3px);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--footer-text);
  transition: var(--transition);
  display: inline-block;
}

.footer-links a:hover {
  color: white;
  transform: translateX(5px);
}

.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-contact li {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

.footer-contact li i {
  margin-right: 1rem;
  width: 20px;
  color: var(--primary-light);
}

.footer-subscribe .form-control {
  background-color: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
}

.footer-subscribe .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.footer-bottom {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== Back to Top Button ===== */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
}

.back-to-top.active {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--primary-dark);
  color: white;
  transform: translateY(-3px);
}

/* ===== Responsive Styles ===== */
@media (max-width: 991.98px) {
  .email-sender {
    width: 150px;
  }
}

@media (max-width: 767.98px) {
  .email-sender {
    width: 120px;
  }

  .email-time {
    width: 80px;
  }
}

@media (max-width: 575.98px) {
  .email-item {
    flex-wrap: wrap;
  }

  .email-sender {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .email-content {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .email-time {
    width: 100%;
    text-align: left;
  }
}
