* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ===== Primary Brand ===== */
    --color-primary: #5948EA;
    --color-primary-hover: #4C3DDB;
    --color-primary-light: #E9E7FF;

    /* ===== Success (Completed) ===== */
    --color-success: #16A34A;
    --color-success-light: #DCFCE7;

    /* ===== Warning / Reading ===== */
    --color-warning: #D97706;
    --color-warning-light: #FEF3C7;

    /* ===== Button ===== */
    --color-green: #047857;
    --color-green-light: #ECFDF5;
    --color-green-stroke: #A7F3D0;
    --color-red: #BE123C;
    --color-red-light: #FFF1F2;
    --color-red-stroke: #FECDD3;
    --color-grey-solid: #9CA3AF;

    /* ===== Notification ===== */
    --color-success-notif: #16a34a;
    --color-error-notif: #dc2626;

    /* ===== Background ===== */
    --color-bg-main: #F6F6F8;
    --color-bg-card: #FFFFFF;
    --color-bg-soft: #F1F3F9;
    --color-bg-secondary: #E2E8F0;

    /* ===== Border ===== */
    --color-border: #E5E7EB;

    /* ===== Text ===== */
    --color-text-primary: #1F2937;
    --color-text-secondary: #475569;
    --color-text-muted: #9CA3AF;
    --color-text-white: #FFFFFF;

    /* ===== Shadow ===== */
    --shadow-card: 0 10px 30px rgba(91, 75, 255, 0.08);
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-nav: 0 8px 25px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;

    /* ===== Radius ===== */
    --radius-large: 20px;
    --radius-medium: 12px;
    --radius-small: 8px;

    /* ===== Font Size (Type Scale) ===== */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-md: 1.125rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 1.875rem;
    --text-3xl: 2.25rem;

    /* ===== Font Weight ===== */
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;

    /* ===== Line Height ===== */
    --lh-tight: 1.2;
    --lh-normal: 1.5;
    --lh-relaxed: 1.7;
}

body {
    font-family: "Inter", sans-serif;
    line-height: var(--lh-relaxed);
    display: flex;
    flex-direction: column;
    background-color: var(--color-bg-soft);
}

main {
    margin-top: 100px;
    padding: 0 5% 5%;
}

h1 {
    font-size: var(--text-md);
}

h2 {
    margin: 10px 0;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.header-content {
    display: flex;
    padding: 20px 40px;
    justify-content: space-between;
    background-color: var(--color-bg-card);
}

.book-icon a {
    display: flex;
    gap: 12px;
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    text-decoration: none;
    color: var(--color-text-primary);
}


.book-icon a i {
    padding: 0.5rem;
    border-radius: 50px;
    color: var(--color-bg-soft);
    background-color: var(--color-primary);
}

.user-icon a {
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    padding: 0.5rem 0.8rem;
    border-radius: 30px;
    text-decoration: none;
    color: var(--color-primary);
    background-color: var(--color-primary-light);
}

.hero-title {
    font-size: var(--text-2xl);
}

.hero-container {
    display: flex;
    justify-content: space-between;
}

.left-container {
    display: flex;
    width: 600px;
    height: auto;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.right-container {
    display: flex;
    width: fit-content;
    height: auto;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.add-book-form {
    display: flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    height: auto;
    box-shadow: var(--shadow-card);
    border-radius: 20px;
    background-color: var(--color-bg-card);
    transition: var(--transition);
}

.add-book-form:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-soft);
}

.form-container {
    padding: 40px;
    width: fit-content;
    height: auto;
}

.book-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.book-form .input-wrapper {
    width: 100%;
    height: 40px;
    background-color: var(--color-bg-main);
    border: 1px solid var(--color-border);
    border-radius: 15px;
}

.book-form .input {
    width: 100%;
    height: 40px;
    margin-left: 10px;
    border: none;
    outline: none;
    font-size: var(--text-sm);
    background-color: transparent;
    border-radius: 15px;
}

.bottom-input {
    display: flex;
    align-items: center;
    gap: 20px;
}

.book-year-wrapper {
    height: 40px;
    outline: none;
    background-color: var(--color-bg-main);
    border: 1px solid var(--color-border);
    border-radius: 15px;
}

.book-year {
    margin-left: 10px;
    height: 40px;
    outline: none;
    background-color: transparent;
    border: none;
    border-radius: 15px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    font-size: var(--text-sm);
    gap: 12px;
    cursor: pointer;
}

.checkbox[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    display: grid;
    place-content: center;
    cursor: pointer;
}

input[type="checkbox"]:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

input[type="checkbox"]:checked::before {
    content: "";
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 2px;
}

.btn-form {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 15px 0;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 15px;
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    cursor: pointer;
    transition: var(--transition);
}

.btn-form:hover {
    padding: 18px;
    border-radius: 5px;
    background-color: var(--color-primary-hover);
}

.search {
    display: flex;
    width: 98%;
    height: auto;
    padding: 50px;
    box-shadow: var(--shadow-card);
    border-radius: 20px;
    transition: var(--transition);
    background-color: var(--color-primary-light);
}

.search:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-soft);
}

.right-container .stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0 16px;
    height: 48px;
    min-width: 320px;
    box-shadow: var(--shadow-soft);
}

.fa-search {
    font-size: 14px;
    margin-right: 8px;
    opacity: 0.6;
}

.search-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: var(--text-sm);
    width: 100%;
    color: var(--color-text-primary);
}

.search-input::placeholder {
    color: var(--color-text-muted);
}

.search-button {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 15px 24px;
    border-radius: 999px;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    transition: var(--transition);
    cursor: pointer;
}

.search-button:hover {
    padding: 15px 30px;
    border-radius: 5px;
    background: var(--color-primary-hover);
}

.reset-search-btn {
    background-color: var(--color-grey-solid);
}

.stats .stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 25%;
    font-size: var(--text-md);
    font-weight: var(--fw-bold);
    color: var(--color-text-secondary);
    margin: 10px;
    padding: 30px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    border-radius: 20px;
    background-color: var(--color-bg-card);
}

.stats .stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-soft);
}

.stats .stat-card .stat-label {
    font-size: var(--text-sm);
}

.stats .stat-card .stat-number-total {
    color: var(--color-primary);
}

.stats .stat-card .stat-number-completed {
    color: var(--color-success);
}

.section-title {
    margin-top: 20px;
    margin-left: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .fa-book-open {
    padding: 0.5rem;
    border-radius: 50%;
    box-shadow: var(--shadow-soft);
    color: var(--color-warning);
    background-color: var(--color-warning-light);
}

.section-title .fa-check-circle {
    padding: 0.5rem;
    border-radius: 50%;
    box-shadow: var(--shadow-soft);
    color: var(--color-success);
    background-color: var(--color-success-light);
}

.section-title .book-count {
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    border-radius: 8px;
    padding: 0 15px;
    box-shadow: var(--shadow-soft);
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
}

.book-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

.book-card {
    width: calc(25% - 15px);
    height: fit-content;
    min-width: 250px;
    flex: 0 1 auto;
    margin: 0;
    padding: 20px;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    background-color: var(--color-bg-card);
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-soft);
}

.book-status {
    display: flex;
    justify-content: space-between;
}

.badge-reading-incompleted {
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    padding: 5px 20px;
    border-radius: 999px;
    color: var(--color-warning);
    background-color: var(--color-warning-light);
}

.badge-reading-completed {
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    padding: 5px 20px;
    border-radius: 999px;
    color: var(--color-success);
    background-color: var(--color-success-light);
}

.book-title {
    margin-top: 30px;
    font-size: var(--text-lg);
    font-weight: var(--fw-bold);
}

.author-container {
    margin-top: 10px;
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    color: var(--color-text-secondary);
    gap: 5px;
}

.btn-outline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 100%;
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    padding: 10px 0;
    margin-top: 15px;
    cursor: pointer;
    border-radius: 15px;
    color: var(--color-bg-card);
    border: 1px solid var(--color-primary);
    background-color: var(--color-primary);
    transition: var(--transition);
}

.btn-outline:hover {
    padding: 13px;
    border-radius: 5px;
    color: var(--color-bg-card);
    background-color: var(--color-primary-hover);
}

.btn-group {
    display: flex;
    justify-content: center;
    margin-top: 15px;
    gap: 10px;
}

.trash-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    padding: 10px;
    border-radius: 15px;
    color: var(--color-red);
    border: 2px solid var(--color-red-stroke);
    background-color: var(--color-red-light);
    cursor: pointer;
    transition: var(--transition);
}

.trash-btn:hover {
    padding: 5px;
    border-radius: 5px;
    background-color: var(--color-red);
    color: var(--color-bg-card);
}

.edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 5px;
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    padding: 10px;
    border-radius: 15px;
    color: var(--color-green);
    border: 2px solid var(--color-green-stroke);
    background-color: var(--color-green-light);
    cursor: pointer;
    transition: var(--transition);

}

.edit-btn:hover {
    padding: 5px;
    border-radius: 5px;
    background-color: var(--color-green);
    color: var(--color-bg-card);
}

.cancel-btn {
    background-color: #9CA3AF !important;
    color: var(--color-bg-card);
    border: none;
    height: 48px;
    border-radius: 15px;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}

.cancel-btn:hover {
    background-color: #6B7280 !important;
    transform: translateY(-2px);
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-buttons button {
    flex: 1;
}

#notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.notification {
    background-color: #1e293b;
    color: var(--color-bg-card);
    padding: 12px 18px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    background-color: var(--color-success-notif);
}

.notification.error {
    background-color: var(--color-error-notif);
}

/* ===== Icon ===== */
.gravity-ui--clock-arrow-rotate-left {
    display: inline-block;
    width: 16px;
    height: 16px;
    --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M1.5 8a6.5 6.5 0 1 1 7.348 6.445a.75.75 0 1 1-.194-1.487A5.001 5.001 0 1 0 4.5 11.57v-1.32a.75.75 0 0 1 1.5 0v3a.75.75 0 0 1-.75.75h-3a.75.75 0 0 1 0-1.5h1.06A6.48 6.48 0 0 1 1.5 8M8 4.25a.75.75 0 0 1 .75.75v2.625l1.033.775a.75.75 0 1 1-.9 1.2l-1.333-1a.75.75 0 0 1-.3-.6V5A.75.75 0 0 1 8 4.25' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-color: currentColor;
    -webkit-mask-image: var(--svg);
    mask-image: var(--svg);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
}

.material-symbols--check-circle-outline {
    display: inline-block;
    width: 16px;
    height: 16px;
    --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='m10.6 16.6l7.05-7.05l-1.4-1.4l-5.65 5.65l-2.85-2.85l-1.4 1.4zM12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8'/%3E%3C/svg%3E");
    background-color: currentColor;
    -webkit-mask-image: var(--svg);
    mask-image: var(--svg);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
}

/* ===== MEDIA QUERIES - RESPONSIVE DESIGN ===== */

/* Extra Large Devices (Large Desktops, 1400px and down) */
@media screen and (max-width: 1400px) {
    .left-container {
        width: 500px;
    }

    .book-card {
        width: calc(33.333% - 14px);
    }

    .stats .stat-card {
        padding: 25px 15px;
    }
}

/* Large Devices (Desktops, 1200px and down) */
@media screen and (max-width: 1200px) {
    .hero-container {
        gap: 30px;
    }

    .book-card {
        width: calc(50% - 20px);
        min-width: 280px;
    }

    .search-wrapper {
        min-width: 280px;
    }
}

/* Medium Devices (Tablets Landscape, 992px and down) */
@media screen and (max-width: 992px) {
    .hero-container {
        flex-direction: column;
        align-items: center;
    }

    .left-container {
        width: 100%;
        max-width: 700px;
        margin: 0 auto;
        padding: 20px 0;
    }

    .right-container {
        width: 100%;
        max-width: 700px;
    }

    .add-book-form {
        width: 100%;
    }

    .form-container {
        padding: 30px;
    }

    .search {
        padding: 40px 30px;
        width: 100%;
    }

    .search-wrapper {
        min-width: 240px;
    }

    .stats {
        flex-wrap: wrap;
        gap: 15px;
    }

    .stats .stat-card {
        width: calc(50% - 8px);
        margin: 0;
    }

    .book-wrapper {
        gap: 15px;
    }

    .book-card {
        width: calc(50% - 8px);
        min-width: 240px;
    }
}

/* Small Devices (Tablets Portrait, 768px and down) */
@media screen and (max-width: 768px) {
    :root {
        --text-2xl: 1.75rem;
        --text-xl: 1.35rem;
        --text-lg: 1.125rem;
        --text-md: 1rem;
        --text-base: 0.938rem;
        --text-sm: 0.875rem;
        --text-xs: 0.75rem;
    }

    main {
        margin-top: 80px;
        padding: 0 4% 8%;
    }

    .header-content {
        padding: 12px 20px;
    }

    .book-icon a span,
    .user-icon a span {
        display: none;
    }

    .book-icon a i {
        padding: 0.7rem;
        font-size: 1.1rem;
    }

    .user-icon a {
        padding: 0.7rem 0.9rem;
    }

    .user-icon a i {
        margin: 0;
        font-size: 1.1rem;
    }

    .hero-title {
        text-align: center;
        margin-bottom: 20px;
    }

    .left-container {
        padding: 10px 0;
    }

    .form-container {
        padding: 25px;
    }

    .bottom-input {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .book-year-wrapper {
        width: 100%;
        height: 44px;
    }

    .book-year {
        width: calc(100% - 10px);
        height: 44px;
        font-size: var(--text-sm);
    }

    .checkbox-group {
        justify-content: flex-start;
        margin: 10px 0;
        font-size: var(--text-sm);
    }

    .checkbox[type="checkbox"] {
        width: 22px;
        height: 22px;
    }

    .btn-form {
        padding: 16px 0;
        margin: 20px 0;
        font-size: var(--text-sm);
        height: auto;
        min-height: 52px;
        border-radius: 12px;
    }

    .btn-form:hover {
        padding: 16px 0;
        transform: translateY(-2px);
        box-shadow: var(--shadow-soft);
    }

    .search-button {
        padding: 16px 24px;
        font-size: var(--text-sm);
        min-height: 52px;
        width: 100%;
        border-radius: 12px;
    }

    .search-button:hover {
        padding: 16px 24px;
        transform: translateY(-2px);
    }

    .reset-search-btn {
        min-height: 52px;
    }

    .btn-outline {
        padding: 14px 0;
        font-size: var(--text-sm);
        min-height: 48px;
        margin-top: 15px;
        border-radius: 12px;
    }

    .btn-outline:hover {
        padding: 14px 0;
        transform: translateY(-2px);
    }

    .btn-group {
        display: flex;
        flex-direction: row;
        gap: 12px;
        margin-top: 15px;
    }

    .trash-btn,
    .edit-btn {
        padding: 12px;
        font-size: var(--text-sm);
        min-height: 48px;
        border-radius: 12px;
        gap: 8px;
    }

    .trash-btn:hover,
    .edit-btn:hover {
        padding: 12px;
        transform: translateY(-2px);
    }

    .cancel-btn {
        height: 52px;
        font-size: var(--text-sm);
        border-radius: 12px;
    }

    .form-buttons {
        display: flex;
        flex-direction: row;
        gap: 12px;
        margin-top: 20px;
    }

    .form-buttons button {
        flex: 1;
        min-height: 52px;
    }

    .search {
        flex-direction: column-reverse;
        gap: 20px;
        padding: 30px 25px;
    }

    .search-form {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-wrapper {
        min-width: 100%;
        height: 52px;
        border-radius: 12px;
    }

    .fa-search {
        font-size: 16px;
    }

    .search-input {
        font-size: var(--text-sm);
    }

    .stats {
        flex-direction: column;
        gap: 12px;
    }

    .stats .stat-card {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 18px 22px;
    }

    .stats .stat-card .stat-number-total,
    .stats .stat-card .stat-number-completed {
        font-size: var(--text-lg);
    }

    .section-title {
        margin-left: 0;
        margin-top: 30px;
    }

    .section-title .fa-book-open,
    .section-title .fa-check-circle {
        padding: 0.6rem;
        font-size: 1.1rem;
    }

    .book-wrapper {
        justify-content: center;
        gap: 20px;
    }

    .book-card {
        width: 100%;
        max-width: 450px;
        margin: 0 auto;
        padding: 25px;
    }

    .book-status {
        flex-wrap: wrap;
        gap: 12px;
    }

    .badge-reading-incompleted,
    .badge-reading-completed {
        padding: 6px 18px;
        font-size: var(--text-xs);
    }

    .book-title {
        margin-top: 20px;
        font-size: var(--text-base);
    }

    .author-container {
        margin-top: 10px;
        font-size: var(--text-sm);
        flex-wrap: wrap;
        gap: 8px;
    }

    #notification-container {
        width: 90%;
        max-width: 400px;
    }

    .notification {
        font-size: 14px;
        padding: 14px 18px;
        border-radius: 12px;
    }
}

/* Extra Small Devices (Large Phones, 576px and down) */
@media screen and (max-width: 576px) {
    :root {
        --text-2xl: 1.5rem;
        --text-xl: 1.25rem;
        --text-lg: 1.125rem;
        --text-base: 1rem;
        --text-sm: 0.875rem;
        --text-xs: 0.75rem;
        --radius-large: 16px;
    }

    main {
        margin-top: 70px;
        padding: 0 4% 10%;
    }

    .header-content {
        padding: 10px 16px;
    }

    .book-icon a i,
    .user-icon a {
        padding: 0.6rem;
    }

    .form-container {
        padding: 20px;
    }

    .book-form .input-wrapper {
        height: 48px;
        border-radius: 12px;
    }

    .book-form .input {
        height: 48px;
        font-size: var(--text-sm);
        margin-left: 15px;
    }

    .book-year-wrapper {
        height: 48px;
        border-radius: 12px;
    }

    .book-year {
        height: 48px;
        font-size: var(--text-sm);
    }

    .checkbox-group {
        font-size: var(--text-sm);
        gap: 10px;
    }

    .checkbox[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    .btn-group {
        flex-direction: column;
        gap: 10px;
    }

    .btn-form,
    .search-button,
    .reset-search-btn,
    .btn-outline,
    .trash-btn,
    .edit-btn,
    .cancel-btn {
        min-height: 56px;
        font-size: 1rem;
        padding: 16px 0;
        border-radius: 14px;
    }

    .trash-btn,
    .edit-btn {
        padding: 16px;
        justify-content: center;
        gap: 10px;
    }

    .trash-btn i,
    .edit-btn i,
    .btn-outline i {
        font-size: 1.1rem;
    }

    .form-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .form-buttons button {
        min-height: 56px;
    }

    .search {
        padding: 25px 20px;
    }

    .search-wrapper {
        height: 56px;
        border-radius: 14px;
        padding: 0 18px;
    }

    .fa-search {
        font-size: 18px;
        margin-right: 10px;
    }

    .search-input {
        font-size: 1rem;
    }

    .search-button {
        padding: 16px 24px;
    }

    .stats .stat-card {
        padding: 16px 20px;
    }

    .stats .stat-card .stat-number-total,
    .stats .stat-card .stat-number-completed {
        font-size: 1.25rem;
    }

    .stats .stat-card .stat-label {
        font-size: var(--text-sm);
    }

    .section-title {
        gap: 10px;
    }

    .section-title h2 {
        font-size: var(--text-lg);
    }

    .section-title .book-count {
        font-size: var(--text-xs);
        padding: 4px 14px;
    }

    .section-title .fa-book-open,
    .section-title .fa-check-circle {
        padding: 0.5rem;
        font-size: 1rem;
    }

    .book-card {
        padding: 20px;
    }

    .badge-reading-incompleted,
    .badge-reading-completed {
        padding: 5px 16px;
        font-size: 0.75rem;
    }

    .book-title {
        margin-top: 18px;
        font-size: 1.125rem;
    }

    .author-container {
        font-size: var(--text-sm);
    }

    .gravity-ui--clock-arrow-rotate-left,
    .material-symbols--check-circle-outline {
        width: 18px;
        height: 18px;
    }
}

/* Small Phones (400px and down) */
@media screen and (max-width: 400px) {
    :root {
        --text-2xl: 1.35rem;
        --text-xl: 1.125rem;
        --text-lg: 1rem;
    }

    main {
        margin-top: 65px;
        padding: 0 3% 12%;
    }

    .btn-form,
    .search-button,
    .reset-search-btn,
    .btn-outline,
    .trash-btn,
    .edit-btn,
    .cancel-btn {
        min-height: 52px;
        font-size: 0.938rem;
        padding: 14px 0;
    }

    .trash-btn,
    .edit-btn {
        padding: 14px;
    }

    .form-container {
        padding: 15px;
    }

    .search {
        padding: 20px 15px;
    }

    .search-wrapper {
        height: 52px;
        padding: 0 15px;
    }

    .fa-search {
        font-size: 16px;
        margin-right: 8px;
    }

    .stats .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 15px;
    }

    .stats .stat-card .stat-number-total,
    .stats .stat-card .stat-number-completed {
        font-size: 1.125rem;
    }

    .book-card {
        padding: 18px;
    }

    .book-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .badge-reading-incompleted,
    .badge-reading-completed {
        width: fit-content;
    }

    .book-title {
        font-size: 1rem;
    }

    .author-container {
        font-size: 0.813rem;
    }

    .btn-group {
        gap: 8px;
    }

    .gravity-ui--clock-arrow-rotate-left,
    .material-symbols--check-circle-outline {
        width: 16px;
        height: 16px;
    }
}

/* Height-based Media Query (for short screens) */
@media screen and (max-height: 700px) and (max-width: 768px) {
    header {
        position: sticky;
    }

    main {
        margin-top: 20px;
    }

    .btn-form,
    .search-button,
    .btn-outline,
    .trash-btn,
    .edit-btn {
        min-height: 48px;
    }

    .add-book-form:hover,
    .book-card:hover,
    .search:hover,
    .btn-form:hover,
    .stats .stat-card:hover {
        transform: none;
    }
}

/* Landscape Mode for Phones */
@media screen and (orientation: landscape) and (max-height: 500px) {
    header {
        position: sticky;
    }

    main {
        margin-top: 20px;
    }

    .hero-container {
        flex-direction: row;
        gap: 20px;
    }

    .left-container {
        width: 45%;
    }

    .right-container {
        width: 55%;
    }

    .form-container {
        padding: 20px;
    }

    .bottom-input {
        flex-direction: row;
        gap: 12px;
    }

    .book-year-wrapper {
        width: auto;
        min-width: 120px;
    }

    .btn-group {
        flex-direction: row;
    }

    .btn-form,
    .search-button,
    .btn-outline,
    .trash-btn,
    .edit-btn {
        min-height: 44px;
        padding: 12px 0;
    }

    .search {
        padding: 20px;
    }

    .search-wrapper {
        height: 44px;
    }

    .book-wrapper {
        justify-content: flex-start;
    }

    .book-card {
        width: calc(33.333% - 14px);
        min-width: 220px;
    }

    .book-status {
        flex-wrap: wrap;
    }
}