/* browser-fixes.css - Chứa các bản vá cụ thể cho từng trình duyệt */

/* Safari */
@supports (-webkit-touch-callout: none) {
  input, textarea, button, select {
    -webkit-appearance: none;
    border-radius: 0;
  }
  
  .btn, .form-control, .card {
    -webkit-border-radius: 4px;
  }
  
  .btn-danger, .btn-primary {
    /* Safari specific button fixes */
    color: white !important;
    background-color: var(--netflix-red) !important;
  }
  
  /* Fix cho danh sách email trong Safari */
  #email-list .list-group-item, 
  .email-item {
    background-color: var(--netflix-gray) !important;
    color: var(--netflix-white) !important;
    border-left: 3px solid transparent;
  }
  
  #email-list .list-group-item:hover,
  .email-item:hover {
    background-color: var(--netflix-dark-gray) !important;
    border-left: 3px solid var(--netflix-red) !important;
  }
  
  #email-info-bar {
    -webkit-backdrop-filter: blur(10px);
  }
  
  #email-display {
    -webkit-word-break: break-all;
  }
}

/* Firefox */
@-moz-document url-prefix() {
  .email-item .email-preview,
  .list-group-item .email-preview {
    overflow: hidden;
    display: -moz-box;
    -moz-box-orient: vertical;
  }
  
  input::placeholder {
    opacity: 1;
  }
  
  select {
    text-indent: 0;
    text-overflow: '';
  }
  
  .btn {
    /* Firefox specific button fixes */
    display: -moz-box;
    -moz-box-pack: center;
    -moz-box-align: center;
  }
  
  /* Fix cho danh sách email trong Firefox */
  #email-list, 
  .list-group-flush {
    background-color: var(--netflix-black) !important;
  }
  
  #email-list .list-group-item, 
  .list-group-item {
    background-color: var(--netflix-gray) !important;
    color: var(--netflix-white) !important;
    border-width: 0 0 1px 3px !important;
  }
  
  #email-display {
    word-break: break-all;
  }
}

/* Edge và IE */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  body {
    overflow-y: auto;
  }
  
  .email-preview {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  
  .card {
    border: none !important;
  }
  
  /* Fix cho danh sách email trong Edge và IE */
  #email-list .list-group-item {
    background-color: #222222 !important;
    color: #f5f5f1 !important;
  }
  
  .email-item {
    background-color: #222222 !important;
    color: #f5f5f1 !important;
  }
}

/* Edge và Chromium */
@supports (-ms-ime-align:auto) {
  .form-control::placeholder {
    color: var(--netflix-light-gray) !important;
  }
  
  /* Fix cho danh sách email trong Edge và Chromium */
  #email-list, 
  #email-list .list-group-item {
    background-color: var(--netflix-gray) !important;
    color: var(--netflix-white) !important;
  }
}

/* Chromium */
@media screen and (-webkit-min-device-pixel-ratio:0) {
  select {
    background-image: none;
  }
  
  input[type="color"],
  input[type="date"],
  input[type="datetime"],
  input[type="datetime-local"],
  input[type="email"],
  input[type="month"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="text"],
  input[type="time"],
  input[type="url"],
  input[type="week"],
  select:focus,
  textarea {
    font-size: 16px;
  }
  
  /* Fix cho danh sách email trong Chrome */
  .list-group, 
  #email-list {
    background-color: var(--netflix-black) !important;
  }
  
  .list-group-item, 
  #email-list .list-group-item {
    background-color: var(--netflix-gray) !important;
    color: var(--netflix-white) !important;
    border-color: rgba(255, 255, 255, 0.05);
  }
}

/* iOS */
@supports (-webkit-overflow-scrolling: touch) {
  input, select, textarea {
    font-size: 16px;
  }
  
  body {
    -webkit-text-size-adjust: 100%;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix cho danh sách email trong iOS */
  .list-group-item {
    -webkit-background-color: var(--netflix-gray);
    background-color: var(--netflix-gray) !important;
    -webkit-color: var(--netflix-white);
    color: var(--netflix-white) !important;
  }
}

/* Các sửa lỗi chung cho tất cả trình duyệt */
input:focus, button:focus, select:focus, textarea:focus, a:focus {
  outline: none;
}

/* Fix vấn đề với -webkit-appearance trên Safari và Chrome */
input[type="search"] {
  -webkit-appearance: none;
}

button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Fix vấn đề với các màu chữ */
.text-danger {
  color: var(--netflix-red) !important;
}

.text-white {
  color: white !important;
}

.text-light {
  color: var(--netflix-white) !important;
}

/* Fix cho các phần tử flex */
.d-flex {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.align-items-center {
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.justify-content-center {
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
}

.justify-content-between {
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

/* Fix cho transition */
.transition {
  -webkit-transition: all 0.2s ease;
  transition: all 0.2s ease;
}

/* Fix đặc biệt cho hiển thị email-list */
#email-list {
  background-color: transparent !important;
}

.card-body {
  background-color: var(--netflix-black) !important;
}

/* Fix cho hiển thị chi tiết email */
#email-content-container {
  background-color: var(--netflix-dark-gray) !important;
  color: var(--netflix-white) !important;
}

/* Đảm bảo card-body không có padding khi hiển thị danh sách email */
#email-list-container .card-body {
  padding: 0 !important;
}

/* Đảm bảo mọi list-group đều có màu nền tối */
.list-group, .list-group-flush {
  background-color: var(--netflix-black) !important;
}

/* Fix hiển thị email dài trên các trình duyệt */
.email-item {
  display: flex;
  flex-direction: column;
}

.email-item > div {
  width: 100%;
}

.email-item .email-from {
  word-break: break-word;
  -ms-word-break: break-word;
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  hyphens: auto;
}

/* Fix cho Firefox */
@-moz-document url-prefix() {
  .email-item .email-from,
  .list-group-item .email-from {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
  }
}

/* Fix cho Chrome */
@media screen and (-webkit-min-device-pixel-ratio:0) {
  .email-item .email-from,
  .list-group-item .email-from {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
  }
}

/* Fix cho Safari */
@supports (-webkit-touch-callout: none) {
  .email-item .email-from,
  .list-group-item .email-from {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
  }
}

/* Fix cho IE và Edge */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  .email-item .email-from,
  .list-group-item .email-from {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
  }
}

/* Fix cho modal email detail */
#email-sender, #email-recipient {
  word-break: break-all;
  max-width: 100%;
  display: inline-block;
}

/* Đảm bảo thanh hiển thị email đúng trên tất cả trình duyệt */
#email-info-bar {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 999 !important;
    position: relative !important;
    background-color: rgba(24, 24, 24, 0.97) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

/* Class d-none từ Bootstrap sẽ ghi đè, nên cần quy tắc riêng */
#email-info-bar.d-none {
    display: none !important;
    visibility: hidden !important;
}

/* Đảm bảo text email hiển thị */
#email-display {
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    display: inline-block !important;
    color: var(--netflix-white) !important;
    font-family: var(--body-font) !important;
}

/* Quy tắc cụ thể cho từng trình duyệt */
/* Safari */
@supports (-webkit-touch-callout: none) {
    #email-info-bar {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1030 !important;
    }
}

/* Chrome/Edge */
@supports (-webkit-appearance:none) and (not (-webkit-touch-callout:none)) {
    #email-info-bar {
        position: relative !important;
        z-index: 999 !important;
    }
}

/* Firefox */
@-moz-document url-prefix() {
    #email-info-bar {
        position: relative !important;
        z-index: 999 !important;
    }
} 