/* SaaS Profile Dashboard Frontend Styles */
:root {
  --spd-primary-color: #3498db;
  --spd-secondary-color: #2c3e50;
  --spd-accent-color: #e74c3c;
  --spd-background-color: #f8f9fa;
  --spd-card-background: #ffffff;
  --spd-text-color: #333333;
  --spd-text-secondary: #666666;
  --spd-border-color: #e1e5e9;
  
  /* Sidebar / Header Defaults */
  --spd-sidebar-background: #2c3e50;
  --spd-sidebar-text: #ecf0f1;
  --spd-sidebar-hover: #34495e;
  
  /* Top Layout Custom Colors */
  --spd-header-bg-color: #2c3e50;
  --spd-menu-text-color: #ecf0f1;
  --spd-menu-hover-color: #3498db;
}

/* Reset and Base Styles */
.spd-profile-wrapper * {
  box-sizing: border-box;
}

.spd-profile-wrapper {
  /* Restored default block width. Elementor or the theme handles the edge-to-edge logic natively. */
  width: 100%;
  margin: 0 auto;
  padding: 0;
  
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: transparent;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Layout Containers */
.spd-layout-sidebar .spd-profile-container,
.spd-layout-top .spd-profile-container {
  width: 100%;
  display: flex;
  background: var(--spd-card-background);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  min-height: 80vh;
  border-radius: 0;
}

.spd-layout-top .spd-profile-container {
  flex-direction: column;
}

/* Sidebar Styles */
.spd-profile-sidebar {
  width: 280px;
  background: var(--spd-sidebar-background);
  color: var(--spd-sidebar-text);
  display: flex;
  flex-direction: column;
  min-height: 80vh;
  flex-shrink: 0;
}

.spd-profile-header {
  padding: 2rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spd-avatar {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
}

.spd-avatar img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--spd-primary-color);
  object-fit: cover;
}

/* Top Layout Header */
.spd-profile-header-top {
  background: var(--spd-header-bg-color);
  color: var(--spd-menu-text-color);
  padding: 1.5rem 4%; /* Added 4% horizontal padding to prevent edge-sticking */
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.spd-user-info-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* Group Avatar and Text together */
.spd-user-profile-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.spd-avatar-small {
  position: relative;
  display: inline-block;
}

.spd-avatar-small img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  object-fit: cover;
  display: block;
}

.spd-avatar-plus {
  position: absolute;
  bottom: 0;
  right: -5px;
  background: var(--spd-menu-hover-color, var(--spd-primary-color));
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  border: 2px solid var(--spd-header-bg-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}

.spd-user-details {
  text-align: left;
}

.spd-user-details h3 {
  margin: 0 0 2px 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--spd-menu-text-color);
}

.spd-user-details .spd-user-email {
  margin: 0;
  opacity: 0.8;
  font-size: 0.9rem;
  color: var(--spd-menu-text-color);
}

.spd-logout-top .spd-logout-link {
  display: flex;
  align-items: center;
  color: var(--spd-menu-text-color);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  opacity: 0.8;
  font-weight: 500;
}

.spd-logout-top .spd-logout-link:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.spd-logout-top .spd-logout-link i {
  margin-right: 0.5rem;
}

/* Navigation Styles */
.spd-profile-nav {
  flex: 1;
  padding: 1rem 0;
}

.spd-profile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.spd-profile-nav a {
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  color: var(--spd-sidebar-text);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.spd-profile-nav a:hover, .spd-profile-nav li.active a {
  background: var(--spd-sidebar-hover);
  border-left-color: var(--spd-primary-color);
}

/* Top Navigation */
.spd-profile-nav-top {
  margin-top: 10px;
}

.spd-profile-nav-top ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 10px;
  flex-wrap: wrap;
}

.spd-profile-nav-top a {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  color: var(--spd-menu-text-color);
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 6px;
  font-weight: 500;
  opacity: 0.9;
}

.spd-profile-nav-top a i {
  margin-right: 8px;
}

.spd-profile-nav-top a:hover {
  background: rgba(255,255,255,0.1);
  opacity: 1;
}

.spd-profile-nav-top li.active a {
  background: var(--spd-menu-hover-color);
  color: #ffffff;
  opacity: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Sidebar Footer */
.spd-sidebar-footer {
  padding: 1rem 2rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.spd-logout-link {
  display: flex;
  align-items: center;
  color: var(--spd-sidebar-text);
  text-decoration: none;
  padding: 0.75rem 0;
  transition: all 0.3s ease;
  opacity: 0.8;
}

.spd-logout-link:hover {
  opacity: 1;
  color: var(--spd-accent-color);
}

/* Main Content Styles */
.spd-profile-main, .spd-profile-main-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--spd-card-background);
}

.spd-profile-header-main {
  padding: 2rem 4%; /* Added 4% horizontal padding */
  border-bottom: 1px solid var(--spd-border-color);
}

.spd-profile-header-main h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--spd-text-color);
}

.spd-profile-content, .spd-profile-content-full {
  flex: 1;
  padding: 2rem 4%; /* Added 4% horizontal padding */
  overflow-y: auto;
  width: 100%;
}

/* Dashboard Widgets */
.spd-dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.spd-widget {
  background: var(--spd-card-background);
  border: 1px solid var(--spd-border-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Forms */
.spd-profile-form, .spd-settings-form {
  max-width: 600px;
}

.spd-form-row {
  margin-bottom: 1.5rem;
}

.spd-form-row label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--spd-text-color);
}

.spd-form-row input[type="text"],
.spd-form-row input[type="email"],
.spd-form-row input[type="password"],
.spd-form-row input[type="file"],
.spd-form-row textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--spd-border-color);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--spd-card-background);
  color: var(--spd-text-color);
}

/* Buttons */
.spd-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

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

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

/* OTP Password Box */
.spd-otp-box {
  margin-top: 25px;
  padding: 20px;
  border: 1px solid var(--spd-border-color);
  border-radius: 8px;
  background: var(--spd-background-color);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.02);
}
.spd-otp-box h4 {
  margin-top: 0;
  font-size: 1.1rem;
}

/* Notices */
.spd-notice {
  padding: 1rem 1.5rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  border-left: 4px solid;
}
.spd-notice-success { background: #d4edda; color: #155724; border-left-color: #28a745; }
.spd-notice-error { background: #f8d7da; color: #721c24; border-left-color: var(--spd-accent-color); }

/* Avatar Upload Preview */
.spd-avatar-preview {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
}
.spd-avatar-preview img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--spd-border-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .spd-user-info-top { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .spd-logout-top { align-self: flex-start; }
}