/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* Header Styles - FIXED: Removed nowrap constraints */
.amazon-header {
    background-color: #131921;
    color: white;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

/* Logo and User Info Container */
.logo-user-container {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: auto;
    flex-wrap: wrap;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    flex-wrap: wrap;
}

.logo i {
    margin-right: 5px;
    font-size: 1.5rem;
}

.logo-text {
    white-space: normal;
    word-break: break-word;
}

/* User Info */
.user-info {
    margin-left: 0;
    flex-wrap: wrap;
}

.user-info .header-action {
    padding: 5px 8px;
    margin: 0;
    flex-wrap: wrap;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 3px;
}

/* Search Bar - AMAZON STYLE - FIXED: More flexible */
.search-bar {
    display: flex;
    flex: 1 1 auto;
    max-width: 600px;
    margin: 0 20px;
    min-width: 150px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: white;
    flex-shrink: 1;
}

.search-category {
    background: #f3f3f3;
    border: none;
    border-right: 1px solid #ddd;
    padding: 0 10px;
    font-size: 0.8rem;
    color: #555;
    cursor: pointer;
    min-width: auto;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 25px;
    flex-shrink: 0;
}

.search-bar input {
    flex: 1 1 auto;
    border: none;
    padding: 0 12px;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    min-width: 0;
}

.search-bar button {
    background: #febd69;
    border: none;
    padding: 0 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 45px;
    flex-shrink: 0;
}

.search-bar button:hover {
    background: #f3a847;
}

/* Live Search Styles */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.search-suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
    cursor: pointer;
}

.search-suggestion-item:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    color: #333;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item img {
    width: 40px;
    height: 50px;
    object-fit: cover;
    margin-right: 12px;
    border-radius: 4px;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.suggestion-info {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-author {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-price {
    font-size: 14px;
    font-weight: bold;
    color: #B12704;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.search-loading {
    padding: 15px;
    text-align: center;
    color: #666;
}

.search-loading i {
    margin-right: 8px;
}

/* Header Actions - Cart only - FIXED: More flexible */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.header-action {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    white-space: normal;
    flex-shrink: 0;
    min-width: 0;
}

.header-action span:first-child {
    font-size: 0.8rem;
    line-height: 1;
}

.header-action span:last-child {
    font-size: 0.9rem;
    font-weight: bold;
    line-height: 1;
}

.cart-action {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.cart-icon {
    font-size: 1.3rem;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff9900;
    color: black;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Breadcrumb */
.breadcrumb {
    padding: 15px 0;
    font-size: 0.9rem;
    overflow-wrap: break-word;
}

.breadcrumb a {
    color: #007185;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #c7511f;
    text-decoration: underline;
}

/* Book Detail Layout - FIXED: Responsive grid instead of fixed widths */
.book-detail {
    display: grid;
    grid-template-columns: minmax(300px, 360px) 1fr minmax(280px, 320px);
    gap: 25px;
    margin: 20px 0;
    align-items: start;
    width: 100%;
}

.book-cover {
    text-align: center;
    width: 100%;
}

.book-cover img {
    max-width: 100%;
    height: auto;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.book-info {
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.book-info h1 {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    margin-bottom: 10px;
    color: #0F1111;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.author {
    color: #007185;
    text-decoration: none;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    display: block;
    margin-bottom: 15px;
    word-wrap: break-word;
}

.author:hover {
    color: #c7511f;
}

.rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.rating i {
    color: #FFA41C;
    font-size: clamp(0.8rem, 3vw, 1rem);
}

.rating-count {
    color: #007185;
    font-size: 0.9rem;
}

/* Tabs - ENHANCED: Better visibility for all tabs */
.book-tabs {
    margin-top: 20px;
    width: 100%;
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px; /* Add padding for active border */
}

.tab-nav::-webkit-scrollbar {
    display: none;
}

.tab-link {
    background: none;
    border: none;
    padding: 12px clamp(12px, 2.5vw, 20px); /* Increased minimum padding */
    cursor: pointer;
    font-size: clamp(0.85rem, 2.2vw, 0.9rem);
    color: #666;
    border-bottom: 3px solid transparent; /* Thicker border for better visibility */
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.3s ease;
    font-weight: 500; /* Slightly bolder for better readability */
    position: relative;
    min-height: 48px; /* Better touch target */
    display: flex;
    align-items: center;
}

/* HIGHLIGHT "About the Author" and "Preview" tabs with distinct styling */
.tab-link[data-tab="author"],
.tab-link[data-tab="preview"] {
    background-color: rgba(228, 121, 17, 0.05); /* Light orange background */
    border-radius: 6px 6px 0 0;
    margin: 0 2px;
    border: 1px solid rgba(228, 121, 17, 0.2);
    border-bottom: 3px solid transparent;
}

.tab-link[data-tab="author"]:hover,
.tab-link[data-tab="preview"]:hover {
    background-color: rgba(228, 121, 17, 0.1);
    border-color: rgba(228, 121, 17, 0.3);
}

.tab-link[data-tab="author"].active,
.tab-link[data-tab="preview"].active {
    background-color: rgba(228, 121, 17, 0.15);
    border-color: #e47911;
}

.tab-link.active {
    color: #0F1111;
    border-bottom-color: #e47911;
    font-weight: 600; /* Bolder when active */
    background-color: #f8f9fa; /* Light background for active tab */
    border-radius: 6px 6px 0 0;
}

.tab-link:hover {
    color: #0F1111;
    background-color: #f5f5f5;
    border-bottom-color: #ccc;
}

.tab-pane {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-pane.active {
    display: block;
}

.tab-pane h3 {
    margin-bottom: 15px;
    color: #0F1111;
    font-size: clamp(1.1rem, 3vw, 1.3rem);
}

.tab-pane h4 {
    margin: 15px 0 10px 0;
    color: #0F1111;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

/* Purchase Box - FIXED: Flexible width and better mobile handling */
.purchase-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: clamp(15px, 3vw, 20px);
    position: sticky;
    top: 80px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.purchase-box h3 {
    margin-bottom: 15px;
    color: #0F1111;
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    word-wrap: break-word;
}

.selected-format-display {
    background: #f0f2f2;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: none;
    width: 100%;
    border-left: 4px solid #e47911;
    word-wrap: break-word;
}

.selected-format-text {
    font-weight: bold;
    color: #0F1111;
    display: inline;
}

.selected-format-name {
    color: #e47911;
    font-weight: bold;
    display: inline;
    margin: 0 5px;
}

.selected-format-price {
    color: #B12704;
    font-weight: bold;
    font-size: clamp(1rem, 2vw, 1.1rem);
    display: inline;
    float: right;
}

.format-selection {
    margin-bottom: 20px;
    width: 100%;
}

.format-options {
    display: grid;
    gap: clamp(10px, 2vw, 12px);
    margin-bottom: 20px;
    width: 100%;
}

.format-card {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: clamp(15px, 3vw, 18px);
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
    background: #fafafa;
    min-width: 0;
}

.format-card:hover {
    border-color: #e47911;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.format-card.selected {
    border-color: #e47911;
    background-color: #fef6f0;
    box-shadow: 0 4px 12px rgba(228, 121, 17, 0.2);
}

.format-header {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    margin-bottom: 12px;
    flex-wrap: wrap;
    min-width: 0;
}

.format-header i {
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    color: #666;
    flex-shrink: 0;
}

.format-header h4 {
    flex: 1;
    margin: 0;
    color: #0F1111;
    word-wrap: break-word;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stock-badge {
    background: #007600;
    color: white;
    padding: 4px clamp(6px, 1.5vw, 8px);
    border-radius: 4px;
    font-size: clamp(0.7rem, 1.5vw, 0.75rem);
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.format-price {
    margin-bottom: 12px;
}

.current-price {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    font-weight: bold;
    color: #B12704;
}

.format-features {
    list-style: none;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    padding: 0;
    margin: 0;
}

.format-features li {
    margin-bottom: 6px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    word-wrap: break-word;
    color: #555;
}

.format-features i {
    color: #007600;
    font-size: clamp(0.7rem, 1.8vw, 0.8rem);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Bundle Offers */
.bundle-offers {
    border-top: 2px solid #eee;
    padding-top: 18px;
    width: 100%;
}

.bundle-offers h4 {
    margin-bottom: 12px;
    color: #0F1111;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.bundle-option {
    margin-bottom: 12px;
    width: 100%;
}

.bundle-option label {
    display: block;
    padding: clamp(12px, 3vw, 15px);
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
    background: #fafafa;
    word-wrap: break-word;
}

.bundle-option label:hover {
    border-color: #e47911;
    background: #fef6f0;
}

.bundle-option input:checked + span {
    color: #e47911;
}

.bundle-title {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    word-wrap: break-word;
    color: #0F1111;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
}

.bundle-price {
    display: block;
    color: #B12704;
    font-weight: bold;
    font-size: clamp(1.1rem, 3vw, 1.2rem);
    margin: 5px 0;
}

.bundle-desc {
    display: block;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #666;
    word-wrap: break-word;
    font-style: italic;
    line-height: 1.4;
}

/* Quantity Selector */
.quantity-selector {
    margin-bottom: 20px;
    width: 100%;
}

.quantity-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #0F1111;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
}

.quantity-selector select {
    width: 100%;
    padding: clamp(8px, 2vw, 10px);
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    box-sizing: border-box;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
    transition: border-color 0.3s;
}

.quantity-selector select:focus {
    border-color: #e47911;
    outline: none;
}

/* Action Buttons - FIXED: Better button sizing */
.action-buttons {
    display: grid;
    gap: clamp(10px, 2vw, 12px);
    margin-bottom: 20px;
    width: 100%;
}

.btn {
    padding: clamp(12px, 3vw, 14px) clamp(15px, 3vw, 20px);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2vw, 10px);
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-cart {
    background: #FFD814;
    color: #0F1111;
    border: 2px solid #FCD200;
}

.btn-cart:hover:not(:disabled) {
    background: #F7CA00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 216, 20, 0.3);
}

.btn-buy {
    background: #FFA41C;
    color: #0F1111;
    border: 2px solid #FA8900;
}

.btn-buy:hover:not(:disabled) {
    background: #FA8900;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 164, 28, 0.3);
}

/* Trust Badges */
.trust-badges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: clamp(10px, 2vw, 12px);
    margin-bottom: 15px;
    padding: clamp(15px, 3vw, 18px) 0;
    border-top: 2px solid #eee;
    width: 100%;
}

.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: clamp(0.7rem, 1.8vw, 0.75rem);
    gap: 6px;
    color: #555;
    min-width: 0;
}

.trust-item i {
    color: #007185;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.note {
    font-size: clamp(0.75rem, 2vw, 0.8rem);
    color: #666;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    word-wrap: break-word;
}

.note i {
    color: #007185;
}

/* Review Modal - FIXED */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: clamp(20px, 4vw, 30px);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    right: clamp(15px, 3vw, 20px);
    top: clamp(15px, 3vw, 20px);
    font-size: clamp(1.3rem, 3vw, 1.5rem);
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #000;
    background: #f0f0f0;
}

.modal h3 {
    margin-bottom: 20px;
    color: #0F1111;
    font-size: clamp(1.2rem, 3.5vw, 1.4rem);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #0F1111;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
}

.star-rating-input {
    display: flex;
    gap: clamp(6px, 1.5vw, 8px);
    font-size: clamp(1.5rem, 4vw, 1.8rem);
    justify-content: center;
    margin: 10px 0;
    flex-wrap: wrap;
}

.star-rating-input i {
    cursor: pointer;
    color: #ddd;
    transition: all 0.2s;
}

.star-rating-input i.active,
.star-rating-input i:hover {
    color: #FFA41C;
    transform: scale(1.1);
}

.form-group textarea {
    width: 100%;
    padding: clamp(10px, 2.5vw, 12px);
    border: 2px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    line-height: 1.5;
    transition: border-color 0.3s;
}

.form-group textarea:focus {
    border-color: #e47911;
    outline: none;
}

/* Review Summary - IMPROVED */
.review-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: clamp(20px, 4vw, 25px);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.overall-rating {
    display: flex;
    align-items: center;
    gap: clamp(10px, 3vw, 20px);
    flex-wrap: wrap;
}

.rating-score {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: bold;
    color: #0F1111;
}

.rating-stars {
    display: flex;
    gap: 3px;
}

.rating-stars i {
    color: #FFA41C;
    font-size: clamp(1rem, 3vw, 1.3rem);
}

.rating-count {
    color: #666;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    margin-top: 5px;
}

/* Author Section Styles - ENHANCED for better visibility */
.author-bio {
    margin-top: 20px;
    padding: clamp(20px, 4vw, 25px);
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f4 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    border-left: 5px solid #e47911; /* Add colored border for emphasis */
}

.author-header {
    display: flex;
    align-items: flex-start;
    gap: clamp(15px, 3vw, 20px);
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e8e8e8;
    flex-wrap: wrap;
}

.author-avatar {
    flex-shrink: 0;
}

.author-avatar img {
    width: clamp(80px, 20vw, 120px);
    height: clamp(80px, 20vw, 120px);
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.author-info {
    flex: 1;
    min-width: 0;
}

.author-info h4 {
    font-size: clamp(1.2rem, 3.5vw, 1.4rem);
    color: #0F1111;
    margin-bottom: 8px;
    font-weight: bold;
    word-wrap: break-word;
}

.author-expertise {
    color: #e47911;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    font-weight: 600;
    margin-bottom: 15px;
    font-style: italic;
    padding: 5px 10px;
    background-color: rgba(228, 121, 17, 0.1);
    border-radius: 4px;
    display: inline-block;
}

.author-social {
    display: flex;
    gap: clamp(10px, 2.5vw, 15px);
    flex-wrap: wrap;
}

.author-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(35px, 8vw, 40px);
    height: clamp(35px, 8vw, 40px);
    background: #fff;
    border-radius: 50%;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
    border: 2px solid #e0e0e0;
}

.author-social a:hover {
    background: #e47911;
    color: white;
    border-color: #e47911;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(228, 121, 17, 0.3);
}

.author-social i {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.author-description {
    margin-bottom: 30px;
}

.author-description p {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    line-height: 1.7;
    color: #555;
    text-align: justify;
}

/* Preview Section Styles - ENHANCED for better visibility */
#preview.tab-pane {
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f4 100%);
    padding: clamp(20px, 4vw, 25px);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    border-left: 5px solid #e47911; /* Add colored border for emphasis */
}

#preview .preview-content {
    margin-top: 0;
}

#preview h3 {
    color: #e47911; /* Orange color for preview header */
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8e8e8;
}

/* FIXED: Book Grid Styles for Author Section */
.author-other-books {
    margin-top: 30px;
    padding-top: clamp(20px, 4vw, 25px);
    border-top: 2px solid #e8e8e8;
    width: 100%;
}

.author-other-books h4 {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    color: #0F1111;
    margin-bottom: 20px;
    font-weight: bold;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: clamp(15px, 3vw, 20px);
    margin-top: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.book-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: white;
    border-radius: 8px;
    padding: clamp(12px, 3vw, 15px);
    transition: all 0.3s;
    border: 1px solid #e0e0e0;
    text-align: center;
    height: 100%;
    min-height: clamp(280px, 40vw, 320px);
    box-sizing: border-box;
    min-width: 0;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #e47911;
    text-decoration: none;
    color: inherit;
}

.book-card img {
    width: 100%;
    height: clamp(150px, 25vw, 180px);
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #eee;
    background: #f8f9fa;
    padding: clamp(8px, 2vw, 10px);
}

.book-card h5 {
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    color: #0F1111;
    margin-bottom: 8px;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
    flex-grow: 1;
    word-wrap: break-word;
}

.book-card .price {
    color: #B12704;
    font-weight: bold;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    margin: 0;
    margin-top: auto;
}

/* View More Books Link */
.view-more-books {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
    width: 100%;
}

.view-more-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: clamp(10px, 2.5vw, 12px) clamp(20px, 4vw, 24px);
    background: #e47911;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s;
    border: 2px solid #e47911;
    flex-wrap: wrap;
}

.view-more-link:hover {
    background: transparent;
    color: #e47911;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(228, 121, 17, 0.3);
    text-decoration: none;
}

/* Lesson Styles for What You'll Learn Tab */
.lesson {
    background: white;
    padding: clamp(15px, 3vw, 20px);
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #e47911;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.lesson h4 {
    color: #0F1111;
    margin-bottom: 10px;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.lesson p {
    color: #555;
    line-height: 1.6;
    margin: 0;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
}

/* Reviews List Styles */
.reviews-list {
    margin-top: 20px;
}

.review-item {
    background: white;
    padding: clamp(15px, 3vw, 20px);
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.reviewer-info strong {
    color: #0F1111;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
    display: block;
    margin-bottom: 5px;
}

.review-rating i {
    color: #FFA41C;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}

.review-date {
    color: #666;
    font-size: clamp(0.75rem, 1.8vw, 0.85rem);
}

.review-content {
    color: #555;
    line-height: 1.6;
    margin: 0;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
}

.no-reviews {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

/* Preview Section Styles - ENHANCED */
.preview-content {
    margin-top: 20px;
}

.preview-options {
    display: grid;
    gap: clamp(12px, 2.5vw, 15px);
    margin-bottom: 30px;
}

.preview-btn {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2.5vw, 15px);
    padding: clamp(15px, 3vw, 20px);
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    width: 100%;
    flex-wrap: wrap;
}

.preview-btn:hover {
    border-color: #e47911;
    background: #fef6f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.preview-btn i {
    font-size: clamp(1.5rem, 4vw, 1.8rem);
    color: #e47911;
}

.preview-btn.large {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    font-weight: bold;
}

.sample-chapters {
    background: white;
    padding: clamp(15px, 3vw, 20px);
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.sample-chapters h4 {
    color: #0F1111;
    margin-bottom: 15px;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.sample-chapters ul {
    list-style: none;
    padding-left: 0;
}

.sample-chapters li {
    padding: 10px 0;
    border-bottom: 1px solid #e8e8e8;
    color: #555;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sample-chapters li:before {
    content: "📖";
    font-size: 0.9rem;
}

.sample-chapters li:last-child {
    border-bottom: none;
}

/* UPGRADED: Universal Footer Styles */
.universal-footer {
    background: #232f3e;
    color: #fff;
    padding: clamp(30px, 6vw, 40px) 0 clamp(15px, 3vw, 20px);
    margin-top: 50px;
    border-top: 2px solid #e47911;
    width: 100%;
}

.universal-footer .footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: clamp(20px, 4vw, 30px);
    margin-bottom: 30px;
}

.universal-footer .footer-section h4 {
    color: #fff;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    margin-bottom: 15px;
    font-weight: bold;
}

.universal-footer .footer-section ul {
    list-style: none;
    padding: 0;
}

.universal-footer .footer-section li {
    margin-bottom: 8px;
}

.universal-footer .footer-section a {
    color: #ddd;
    text-decoration: none;
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    transition: color 0.3s;
}

.universal-footer .footer-section a:hover {
    color: #e47911;
    text-decoration: underline;
}

.universal-footer .footer-bottom {
    border-top: 1px solid #3a4553;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
}

.universal-footer .footer-logo .logo {
    color: #fff;
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.universal-footer .footer-links {
    display: flex;
    gap: clamp(10px, 3vw, 20px);
    flex-wrap: wrap;
    justify-content: center;
}

.universal-footer .footer-links a {
    color: #ddd;
    text-decoration: none;
    font-size: clamp(0.8rem, 2vw, 0.85rem);
    transition: color 0.3s;
}

.universal-footer .footer-links a:hover {
    color: #e47911;
}

.universal-footer .footer-copyright {
    color: #999;
    font-size: clamp(0.75rem, 1.8vw, 0.8rem);
}

/* Mobile Responsive Styles - UPDATED with better breakpoints and tab visibility */
@media (max-width: 1200px) {
    .book-detail {
        grid-template-columns: minmax(280px, 340px) 1fr minmax(260px, 300px);
        gap: 20px;
    }
}

@media (max-width: 1024px) {
    .book-detail {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .purchase-box {
        grid-column: 1 / -1;
        position: static;
        margin-top: 20px;
        width: 100%;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .selected-format-price {
        float: none;
        display: block;
        margin-top: 5px;
    }
    
    /* Make tabs more visible on tablet */
    .tab-link {
        padding: 12px 18px;
        font-size: 0.9rem;
    }
}

@media (max-width: 900px) {
    .book-detail {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .book-cover {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .purchase-box {
        order: 3;
        max-width: 100%;
    }
    
    /* Enhance tab visibility on smaller screens */
    .tab-nav {
        justify-content: flex-start;
        gap: 5px;
    }
    
    .tab-link {
        padding: 12px 16px;
        font-size: 0.88rem;
    }
    
    .tab-link[data-tab="author"],
    .tab-link[data-tab="preview"] {
        background-color: rgba(228, 121, 17, 0.1);
        border: 2px solid rgba(228, 121, 17, 0.2);
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .header-top {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-start;
    }
    
    .logo-user-container {
        order: 1;
        flex: 1 1 auto;
        min-width: auto;
    }
    
    .logo {
        margin-bottom: 0;
    }
    
    .user-info {
        margin-left: 0;
        display: none;
    }
    
    .mobile-menu-btn {
        order: 0;
    }
    
    .header-actions {
        order: 2;
        margin-left: auto;
    }
    
    .search-bar {
        order: 3;
        margin: 10px 0 0 0;
        max-width: 100%;
        flex: 1 1 100%;
        min-width: 0;
    }
    
    .header-action span:first-child {
        display: none;
    }
    
    .header-action span:last-child:not(.cart-count) {
        font-size: 0.8rem;
    }
    
    /* MOBILE TAB ENHANCEMENTS - Make tabs clearly visible */
    .tab-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 5px 0 10px 0;
        margin-bottom: 25px;
        background: linear-gradient(to right, #f8f9fa, #fff);
        border-radius: 8px;
        padding: 10px;
    }
    
    .tab-link {
        padding: 14px 18px;
        font-size: 0.92rem;
        font-weight: 600;
        border-bottom: 3px solid transparent;
        background-color: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        margin-right: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* HIGHLIGHT Author and Preview tabs on mobile */
    .tab-link[data-tab="author"],
    .tab-link[data-tab="preview"] {
        background-color: rgba(228, 121, 17, 0.15);
        border: 2px solid rgba(228, 121, 17, 0.3);
        box-shadow: 0 3px 6px rgba(228, 121, 17, 0.1);
        color: #e47911;
        font-weight: 700;
    }
    
    .tab-link.active {
        background-color: #e47911;
        color: white;
        border-color: #e47911;
        box-shadow: 0 4px 8px rgba(228, 121, 17, 0.3);
    }
    
    .tab-link[data-tab="author"].active,
    .tab-link[data-tab="preview"].active {
        background-color: #e47911;
        color: white;
        border-color: #e47911;
    }
    
    .format-options {
        grid-template-columns: 1fr;
    }
    
    .trust-badges {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
    }
    
    /* Mobile adjustments for search */
    .search-suggestions {
        position: fixed;
        top: 120px;
        left: 10px;
        right: 10px;
        max-height: 60vh;
        z-index: 1001;
    }
    
    .search-suggestion-item {
        padding: 10px;
    }
    
    .search-suggestion-item img {
        width: 35px;
        height: 45px;
    }
    
    /* Mobile adjustments for author section */
    .author-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .author-avatar img {
        width: 100px;
        height: 100px;
    }
    
    /* Mobile adjustments for book grid */
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .book-card {
        min-height: 280px;
        padding: 12px;
    }
    
    .book-card img {
        height: 150px;
    }
    
    .book-card h5 {
        font-size: 0.9rem;
    }
    
    .author-bio {
        padding: 20px;
    }
    
    /* Mobile Footer Styles */
    .universal-footer .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .universal-footer .footer-section h4 {
        font-size: 1rem;
    }
    
    .universal-footer .footer-section a {
        font-size: 0.85rem;
    }
    
    .universal-footer .footer-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .selected-format-display {
        text-align: center;
    }
    
    .selected-format-name,
    .selected-format-price {
        display: block;
        margin: 5px 0;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 12px;
    }
    
    .header-top {
        gap: 8px;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .logo i {
        font-size: 1.3rem;
    }
    
    .header-actions {
        gap: 5px;
    }
    
    .header-action {
        padding: 5px;
    }
    
    .search-category {
        padding: 0 8px;
        font-size: 0.7rem;
        min-width: auto;
    }
    
    .search-bar input {
        padding: 0 8px;
        font-size: 0.8rem;
    }
    
    .search-bar button {
        padding: 0 12px;
        min-width: 40px;
    }
    
    .book-info h1 {
        font-size: 1.3rem;
    }
    
    .author {
        font-size: 1rem;
    }
    
    .btn {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .purchase-box {
        padding: 15px;
    }
    
    .modal-content {
        padding: 20px;
        margin: 5% auto;
        width: 95%;
    }
    
    /* Enhanced mobile tabs for small screens */
    .tab-nav {
        padding: 8px;
        background: #f8f9fa;
        border-radius: 10px;
    }
    
    .tab-link {
        padding: 12px 14px;
        font-size: 0.86rem;
        min-height: 48px;
        flex: 1;
        min-width: 120px;
        text-align: center;
        justify-content: center;
    }
    
    /* Make Author and Preview tabs stand out even more on small screens */
    .tab-link[data-tab="author"]::before,
    .tab-link[data-tab="preview"]::before {
        content: "★ ";
        color: #e47911;
        font-size: 0.8rem;
    }
    
    .tab-link[data-tab="author"].active::before,
    .tab-link[data-tab="preview"].active::before {
        color: white;
    }
    
    /* Mobile adjustments for book grid */
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .book-card {
        min-height: 260px;
        padding: 10px;
    }
    
    .book-card img {
        height: 130px;
        padding: 8px;
    }
    
    .book-card h5 {
        font-size: 0.85rem;
        min-height: 2.4em;
    }
    
    .book-card .price {
        font-size: 1rem;
    }
    
    .author-social {
        justify-content: center;
    }
    
    .suggestion-title {
        font-size: 13px;
    }
    
    .suggestion-author {
        font-size: 11px;
    }
    
    .suggestion-price {
        font-size: 13px;
    }
    
    .universal-footer .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 25px;
    }
    
    .universal-footer {
        padding: 30px 0 15px;
    }
    
    .review-summary {
        flex-direction: column;
        text-align: center;
    }
    
    .overall-rating {
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .logo-text {
        display: none;
    }
    
    .search-category {
        display: none;
    }
    
    .header-action span:last-child:not(.cart-count) {
        display: none;
    }
    
    .cart-action .cart-count {
        position: static;
        margin-left: 5px;
    }
    
    /* Final mobile tab optimization for very small screens */
    .tab-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .tab-link {
        flex: 0 0 calc(50% - 8px);
        min-width: calc(50% - 8px);
        max-width: calc(50% - 8px);
        padding: 10px 8px;
        font-size: 0.82rem;
        margin-right: 0;
    }
    
    /* Ensure Author and Preview tabs get full width on very small screens */
    .tab-link[data-tab="author"],
    .tab-link[data-tab="preview"] {
        flex: 0 0 100%;
        min-width: 100%;
        max-width: 100%;
        margin-bottom: 5px;
    }
    
    /* Mobile adjustments for book grid */
    .books-grid {
        grid-template-columns: 1fr;
        max-width: 250px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .book-card {
        min-height: 240px;
    }
    
    .book-card img {
        height: 120px;
    }
    
    .search-suggestions {
        top: 110px;
        left: 5px;
        right: 5px;
    }
    
    .format-header h4 {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    
    .trust-badges {
        grid-template-columns: 1fr;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: flex-end;
    }
}