/* Outlook/Hotmail Style Email Reader */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Segoe UI Web', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #f3f2f1;
  color: #323130;
  line-height: 1.4;
  font-size: 14px;
}

.hidden {
  display: none !important;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e1dfdd;
  border-top: 2px solid #0078d4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner.large {
  width: 32px;
  height: 32px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Login Screen - Outlook Style */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f2f1;
}

.login-card {
  background: white;
  padding: 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.login-header {
  margin-bottom: 24px;
}

.login-header .logo {
  width: 108px;
  height: 24px;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #323130;
  margin-bottom: 4px;
}

.login-header p {
  color: #605e5c;
  font-size: 14px;
}

.login-form .input-group {
  margin-bottom: 16px;
}

.login-form label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #323130;
}

.login-form textarea,
.login-form input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #8a8886;
  border-radius: 2px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.1s;
}

.login-form textarea:focus,
.login-form input:focus {
  outline: none;
  border-color: #0078d4;
  border-width: 2px;
  padding: 7px 11px;
}

.login-form small {
  display: block;
  margin-top: 4px;
  color: #605e5c;
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: 32px;
  border: none;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.1s;
}

.btn-primary {
  background-color: #0078d4;
  color: white;
}

.btn-primary:hover {
  background-color: #106ebe;
}

.btn-primary:active {
  background-color: #005a9e;
}

.btn-full {
  width: 100%;
}

.error-message {
  background-color: #fde7e9;
  border-left: 4px solid #a80000;
  color: #a80000;
  padding: 8px 12px;
  font-size: 12px;
  margin-top: 16px;
}

/* Email Interface - Outlook Style */
.email-interface {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #f3f2f1;
}

/* Header - Outlook Blue */
.header {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  background: #0078d4;
  color: white;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left .btn-icon {
  color: white;
}

.header-left .btn-icon:hover {
  background: rgba(255,255,255,0.1);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-small {
  width: 20px;
  height: 20px;
}

.logo-small path {
  fill: white;
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  color: white;
}

.header-center {
  flex: 1;
  max-width: 500px;
  margin: 0 24px;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  padding: 0 12px;
  height: 32px;
  transition: background 0.1s;
}

.search-box:focus-within {
  background: white;
}

.search-box svg {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.8);
  flex-shrink: 0;
}

.search-box:focus-within svg {
  color: #605e5c;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0 8px;
  font-size: 14px;
  color: white;
  outline: none;
}

.search-box input::placeholder {
  color: rgba(255,255,255,0.8);
}

.search-box:focus-within input {
  color: #323130;
}

.search-box:focus-within input::placeholder {
  color: #605e5c;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-email {
  font-size: 14px;
  color: white;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: #605e5c;
  cursor: pointer;
}

.btn-icon:hover {
  background: rgba(0,0,0,0.05);
}

.header .btn-icon {
  color: white;
}

.header .btn-icon:hover {
  background: rgba(255,255,255,0.1);
}

/* Main Container */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar - Outlook Style */
.sidebar {
  width: 200px;
  background: #faf9f8;
  border-right: 1px solid #edebe9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.folder-list {
  display: flex;
  flex-direction: column;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  color: #323130;
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background 0.1s;
}

.folder-item:hover {
  background: #edebe9;
}

.folder-item.active {
  background: #e1dfdd;
  border-left-color: #0078d4;
  font-weight: 600;
  color: #0078d4;
}

.folder-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.folder-item.active svg {
  color: #0078d4;
}

.folder-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-count {
  font-size: 12px;
  color: #0078d4;
  font-weight: 600;
  background: #e1dfdd;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Email List - Outlook Style */
.email-list-container {
  width: 360px;
  background: white;
  border-right: 1px solid #edebe9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #edebe9;
  background: white;
  min-height: 40px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.email-count {
  font-size: 12px;
  color: #605e5c;
}

.email-list {
  flex: 1;
  overflow-y: auto;
}

.email-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f3f2f1;
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}

.email-item:hover {
  background: #f3f2f1;
}

.email-item.selected {
  background: #edebe9;
}

.email-item.unread {
  border-left: 3px solid #0078d4;
  background: #f0f6ff;
}

.email-item.unread:hover {
  background: #e6f0ff;
}

.email-item.unread .email-sender {
  font-weight: 600;
  color: #323130;
}

.email-item.unread .email-subject {
  font-weight: 600;
}

.email-star {
  padding-top: 2px;
  color: #c8c6c4;
  cursor: pointer;
  flex-shrink: 0;
}

.email-star:hover {
  color: #ffc107;
}

.email-star.flagged {
  color: #d13438;
}

.email-star svg {
  width: 16px;
  height: 16px;
}

.email-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.email-sender {
  font-size: 14px;
  color: #323130;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-subject-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.email-subject {
  font-size: 13px;
  color: #323130;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-preview {
  font-size: 12px;
  color: #605e5c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 250px;
}

.email-attachment {
  color: #605e5c;
  flex-shrink: 0;
}

.email-attachment svg {
  width: 14px;
  height: 14px;
}

.email-date {
  font-size: 11px;
  color: #605e5c;
  white-space: nowrap;
  flex-shrink: 0;
  position: absolute;
  top: 12px;
  right: 16px;
}

/* Email Detail - Outlook Style */
.email-detail {
  flex: 1;
  background: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid #edebe9;
  background: white;
  min-height: 44px;
}

.detail-actions {
  display: flex;
  gap: 4px;
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background: #faf9f8;
}

.select-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #605e5c;
  background: #faf9f8;
}

.select-message svg {
  width: 80px;
  height: 80px;
  color: #c8c6c4;
  margin-bottom: 16px;
}

.select-message p {
  font-size: 14px;
}

/* Email View - Outlook Style */
.email-view {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  max-width: 100%;
}

.email-view-header {
  padding: 20px 24px;
  border-bottom: 1px solid #edebe9;
}

.email-view-subject {
  font-size: 20px;
  font-weight: 600;
  color: #323130;
  margin-bottom: 16px;
  line-height: 1.3;
}

.email-view-meta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.email-view-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0078d4 0%, #00bcf2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.email-view-info {
  flex: 1;
  min-width: 0;
}

.email-view-from {
  font-size: 14px;
  color: #323130;
}

.email-view-from strong {
  font-weight: 600;
}

.email-view-from span {
  color: #605e5c;
  font-size: 12px;
}

.email-view-to {
  font-size: 12px;
  color: #605e5c;
  margin-top: 4px;
}

.email-view-date {
  font-size: 12px;
  color: #605e5c;
  white-space: nowrap;
  text-align: right;
}

/* Email Body Content */
.email-view-body {
  padding: 24px;
  font-size: 14px;
  line-height: 1.5;
  color: #323130;
}

.email-view-body iframe {
  width: 100%;
  border: none;
  min-height: 400px;
}

.email-html-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.email-html-content img {
  max-width: 100%;
  height: auto;
}

.email-html-content table {
  max-width: 100%;
}

.email-html-content a {
  color: #0078d4;
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 16px;
  color: #605e5c;
}

.loading p {
  font-size: 14px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #605e5c;
  text-align: center;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: #c8c6c4;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #323130;
}

.empty-state p {
  font-size: 14px;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -200px;
    top: 48px;
    bottom: 0;
    z-index: 100;
    transition: left 0.2s;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
  }

  .sidebar.open {
    left: 0;
  }

  .email-list-container {
    width: 100%;
    flex: 1;
  }

  .email-detail {
    position: fixed;
    left: 0;
    right: 0;
    top: 48px;
    bottom: 0;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.2s;
  }

  .email-detail.open {
    transform: translateX(0);
  }
}

@media (max-width: 768px) {
  .header-center {
    display: none;
  }

  .user-email {
    display: none;
  }
}

/* Scrollbar Styling - Outlook Style */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c8c6c4;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a19f9d;
}
