/* Scanner Page Styles */

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

body {
    background-image:
        radial-gradient(73% 147%, #EADFDF 59%, #ECE2DF 100%),
        radial-gradient(91% 146%, rgba(255, 255, 255, 0.50) 47%, rgba(0, 0, 0, 0.50) 100%);
    background-blend-mode: screen;
    min-height: 100vh;
    font-family: "Sometype Mono", monospace;
}

/* Navigation Bar */
.navbar {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-brand {
    font-size: 24px;
    font-weight: bold;
    font-family: "PT Sans Narrow", sans-serif;
    color: #6366f1;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: #4b5563;
    font-family: "PT Sans Narrow", sans-serif;
    font-size: 18px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #6366f1;
}

.nav-link.active {
    background: #6366f1;
    color: white;
}

/* Scanner Container */
.scanner-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.scanner-title {
    text-align: center;
    font-size: 36px;
    font-family: "PT Sans Narrow", sans-serif;
    color: #374151;
    margin: 20px 0;
    animation: fadeInDown 0.6s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Video Section */
#anotherviddiv {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

#videodiv {
    position: relative;
    width: 98%;
    max-width: 800px;
    border: 4px solid #374151;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 16/9;
    background: #000;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s ease;
}

#videodiv.scanning {
    border-color: #3b82f6;
    animation: pulse 2s infinite;
}

#videodiv.scan-success {
    border-color: #22c55e;
    animation: successFlash 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 30px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 8px 40px rgba(59, 130, 246, 0.6);
    }
}

@keyframes successFlash {
    0%, 100% {
        box-shadow: 0 8px 30px rgba(34, 197, 94, 0.3);
    }
    50% {
        box-shadow: 0 8px 50px rgba(34, 197, 94, 0.8);
    }
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Scanning Guide Overlay */
.scan-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.scan-frame {
    width: 280px;
    height: 100px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.3);
    animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
    0%, 100% {
        box-shadow:
            0 0 0 9999px rgba(0, 0, 0, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.3),
            0 0 30px rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow:
            0 0 0 9999px rgba(0, 0, 0, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.5),
            0 0 40px rgba(59, 130, 246, 0.8);
    }
}

.scan-instruction {
    color: white;
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    font-weight: bold;
}

/* Scan Success Indicator */
.scan-success-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(34, 197, 94, 0.95);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform 0.3s ease;
}

.scan-success-indicator.show {
    animation: successPop 0.6s ease;
}

@keyframes successPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
    }
}

.checkmark {
    color: white;
    font-size: 60px;
    font-weight: bold;
}

/* Control Buttons */
#buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
    margin: 20px 0;
}

.button-35, .button-37 {
    min-width: 160px;
    height: 55px;
    box-sizing: border-box;
    border-radius: 15px;
    background: #3b82f6;
    box-shadow: #2563eb 0px 6px 0px 0px;
    position: relative;
    font-size: 18px;
    font-family: "PT Sans Narrow", sans-serif;
    font-weight: 700;
    text-align: center;
    color: rgb(255, 255, 255);
    letter-spacing: 1px;
    border: 0px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button-35:hover, .button-37:hover {
    transform: translateY(-2px);
    box-shadow: #2563eb 0px 8px 0px 0px;
}

.button-35:active, .button-37:active {
    transform: translateY(6px);
    box-shadow: #2563eb 0px 0px 0px 0px;
}

.button-35.stop-button {
    background: #ef4444;
    box-shadow: #dc2626 0px 6px 0px 0px;
}

.button-35.stop-button:hover {
    box-shadow: #dc2626 0px 8px 0px 0px;
}

.button-35.stop-button:active {
    box-shadow: #dc2626 0px 0px 0px 0px;
}

.button-37 {
    min-width: 55px;
    width: 55px;
    padding: 0;
    background: #f59e0b;
    box-shadow: #d97706 0px 6px 0px 0px;
}

.button-37:hover {
    box-shadow: #d97706 0px 8px 0px 0px;
}

.button-37:active {
    box-shadow: #d97706 0px 0px 0px 0px;
}

#flashimg {
    width: 30px;
    height: 30px;
}

/* Scanner Info */
.scanner-info {
    text-align: center;
    margin: 10px 0;
}

#tip {
    font-size: 14px;
    color: #6b7280;
    margin: 5px 0;
}

#barcode-status {
    font-size: 18px;
    font-weight: bold;
    color: #374151;
    margin: 10px 0;
}

/* Manual Entry Section */
.manual-entry-section {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
}

.manual-entry-toggle {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 18px;
    font-family: "PT Sans Narrow", sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.manual-entry-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.manual-entry-form {
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-top: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

.manual-entry-form.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.manual-entry-form h3 {
    font-family: "PT Sans Narrow", sans-serif;
    color: #374151;
    margin-bottom: 20px;
    font-size: 24px;
}

#manualIsbn {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    font-family: "Sometype Mono", monospace;
    transition: border-color 0.3s ease;
}

#manualIsbn:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.manual-entry-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.button-search, .button-cancel {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-family: "PT Sans Narrow", sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.button-search {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.button-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.button-cancel {
    background: #f3f4f6;
    color: #374151;
}

.button-cancel:hover {
    background: #e5e7eb;
}

/* Barcode Result */
#barcodeResult {
    text-align: center;
    font-size: 20px;
    color: #374151;
    margin: 20px 0;
    font-weight: bold;
}

/* Loader Section */
#loaderdiv {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
}

/* Skeleton Loader */
.skeleton-loader {
    display: none;
}

.skeleton-loader.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.skeleton-book {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.skeleton-image {
    width: 150px;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 10px;
}

.skeleton-text {
    flex: 1;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 5px;
    margin-bottom: 15px;
}

.skeleton-text.short {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Book Loader Animation */
.loader {
    height: 50px;
    width: 40px;
    position: relative;
    perspective: 80px;
    visibility: hidden;
}

.loader.show {
    visibility: visible;
}

.loader div {
    background: #3b82f6;
    height: 100%;
    position: absolute;
    left: 50%;
    transform-origin: left;
    width: 100%;
}

.loader div:nth-child(1) { animation-delay: 0.15s; }
.loader div:nth-child(2) { animation-delay: 0.3s; }
.loader div:nth-child(3) { animation-delay: 0.45s; }
.loader div:nth-child(4) { animation-delay: 0.6s; }
.loader div:nth-child(5) { animation-delay: 0.75s; }

@keyframes whirl-book {
    0% {
        transform: rotateY(0deg);
    }
    50%, 80% {
        transform: rotateY(-180deg);
    }
    90%, 100% {
        opacity: 0;
        transform: rotateY(-180deg);
    }
}

/* Book Information Card */
#bookinfo {
    display: none;
    max-width: 700px;
    margin: 20px auto;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: scaleIn 0.4s ease;
}

#bookinfo.show {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    align-items: flex-start;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.book-image-container {
    flex-shrink: 0;
}

#imagesource {
    width: 140px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

#imagesource:hover {
    transform: scale(1.03);
}

.book-details-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    font-family: "Sometype Mono", monospace;
    min-width: 0;
}

#bookname {
    font-size: 18px;
    color: #1f2937;
    font-weight: bold;
    line-height: 1.3;
    margin: 0;
}

#genrename, #yearofpublish {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Action Buttons */
#libbuttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 15px;
    margin: 15px 0 40px;
    flex-wrap: wrap;
}

#addtolib {
    position: relative;
    overflow: hidden;
}

.button-36 {
    min-width: 180px;
    padding: 15px 30px;
    border-radius: 15px;
    border: none;
    font-size: 18px;
    font-family: "PT Sans Narrow", sans-serif;
    font-weight: 700;
    text-align: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    visibility: hidden;
}

.button-36.show {
    visibility: visible;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.button-36.add-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.button-36.add-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.button-36.view-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.button-36.view-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.button-36:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 20px;
}

/* Add Animation Feedback */
#added1 {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-align: center;
    opacity: 0;
    pointer-events: none;
}

#added1.show {
    animation: slideUpFade 2s ease;
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(0);
    }
    20% {
        opacity: 1;
        transform: translateY(-10px);
    }
    80% {
        opacity: 1;
        transform: translateY(-10px);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 12px 15px;
    }

    .nav-brand {
        font-size: 20px;
    }

    .nav-links {
        gap: 10px;
    }

    .nav-link {
        font-size: 14px;
        padding: 6px 10px;
    }

    .scanner-title {
        font-size: 28px;
    }

    #videodiv {
        width: 95%;
        border-width: 3px;
    }

    .scan-frame {
        width: 200px;
        height: 80px;
    }

    .scan-instruction {
        font-size: 14px;
    }

    #buttons {
        gap: 10px;
    }

    .button-35, .button-37 {
        min-width: 130px;
        height: 50px;
        font-size: 16px;
    }

    .manual-entry-form {
        padding: 20px;
    }

    #bookinfo.show {
        flex-direction: column;
        align-items: center;
        padding: 20px;
    }

    #imagesource {
        width: 150px;
    }

    .book-details-section {
        text-align: center;
    }

    #bookname {
        font-size: 20px;
    }

    #genrename, #yearofpublish {
        font-size: 16px;
    }

    #libbuttons {
        flex-direction: column;
        align-items: center;
    }

    .button-36 {
        width: 90%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr;
    }

    .manual-entry-buttons {
        flex-direction: column;
    }

    .button-search, .button-cancel {
        width: 100%;
    }
}
