/* Brand colors:
- #324949 (dark teal)
- #792525 (dark red)
- #e1d2c4 (light beige)
- #f7f3df (cream)
- #a7a585 (olive)
- #e1d2c4 (beige)
*/

:root {
    --primary: #324949;
    --secondary: #792525;
    --background: #a7a585;
    --light-bg: #f7f3df;
    --accent: #e1d2c4;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
    --header-height: 80px;
    --footer-height: 100px;
    /* Height for the fixed scan button area */
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--background);
    color: var(--primary);
    font-family: 'Mukta Mahee', sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: var(--footer-height);
    /* Add padding to prevent content being hidden behind fixed scan button */
}

/* Header Styles */
header {
    background-color: var(--white);
    color: var(--primary);
    padding: 12px;
    box-shadow: 0 2px 8px var(--shadow);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    width: 50px;
    height: auto;
    margin-right: 10px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 22pt;
    letter-spacing: 8px;
    font-weight: bold;
    margin: 0;
}

.brand-subtitle {
    font-size: 12pt;
    margin: 0;
}

#header-actions {
    display: flex;
    align-items: center;
}

/* Main Content */
main {
    flex: 1;
    padding: 16px;
    margin-top: var(--header-height);
    max-width: 1200px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 32px - var(--footer-height));
}

.hidden {
    display: none !important;
}

/* Login View */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

#login-form {
    background-color: var(--white);
    padding: 30px;
    border-radius: 12px;
    min-width: 320px;
    box-shadow: 0 4px 12px var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 8px;
    display: inline-block;
}

.form-group input {
    height: 40px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    font-size: 14pt;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(50, 73, 73, 0.2);
}

.error-text {
    color: var(--secondary);
    margin: 12px 0;
    font-weight: bold;
}

/* Button Styles */
.small-button {
    border: none;
    font-size: 11pt;
    background-color: var(--primary);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.small-button:hover {
    background-color: #3e5959;
}

.login-button {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    font-size: 14pt;
}

.product-button {
    border: 2px solid var(--white);
    font-size: 18pt;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    padding: 16px;
    border-radius: 12px;
    width: 100%;
    margin: 8px 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.product-button.selected {
    background-color: var(--primary);
    transform: scale(1.02);
}

/* Action button (scan/stop) */
.scan-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    z-index: 90;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
    height: var(--footer-height);
    display: flex;
    justify-content: center;
    align-items: center;
}

.controls-container {
    display: flex;
    width: 100%;
    max-width: 700px;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0 65px 0 0;
    /* Add right padding to make space for the refresh button */
}

.action-button {
    border: none;
    font-size: 24pt;
    background-color: var(--secondary);
    color: var(--white);
    padding: 16px 24px;
    border-radius: 16px;
    cursor: pointer;
    width: 100%;
    /* Take full width of container (minus the padding) */
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background-color 0.3s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    font-weight: bold;
    letter-spacing: 2px;
}

.action-button:hover {
    background-color: #8c2d2d;
}

.action-button:active {
    transform: scale(0.98);
}

.refresh-button {
    position: absolute;
    right: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--white);
    color: var(--primary);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

.refresh-button:hover {
    background-color: #f0f0f0;
}

.refresh-button:active {
    transform: scale(0.95);
}

.refresh-button svg {
    width: 24px;
    height: 24px;
}

/* Scanner View */
.scanner-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 10px 0;
}

.product-selection {
    margin-bottom: 20px;
}

.selection-label {
    font-size: 16pt;
    font-weight: bold;
    margin: 8px 4px;
    color: var(--primary);
}

.product-buttons {
    display: flex;
    justify-content: space-between;
}

.video-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background-color: var(--light-bg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    min-height: 300px;
}

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

/* Tablet Optimization */
@media (min-width: 768px) and (max-width: 1024px) {
    .video-container {
        min-height: 400px;
    }

    .action-button {
        font-size: 28pt;
    }

    .scan-controls {
        height: 110px;
    }

    .refresh-button {
        width: 60px;
        height: 60px;
    }

    .controls-container {
        padding: 0 75px 0 0;
        /* Increase right padding for larger refresh button */
    }

    .refresh-button svg {
        width: 28px;
        height: 28px;
    }

    :root {
        --footer-height: 110px;
    }
}

/* Notification System */
.notification {
    position: fixed;
    bottom: calc(var(--footer-height) + 20px);
    /* Position above the scan button */
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 300px;
    text-align: center;
    animation: slide-up 0.3s ease-out;
}

.notification.success {
    background-color: #2e8540;
}

.notification.error {
    background-color: #d83933;
}

.notification.info {
    background-color: #02bfe7;
}

.notification.fade-out {
    animation: fade-out 0.5s ease-out forwards;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Mobile Optimization */
@media (max-width: 767px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px 0;
    }

    header {
        height: auto;
        padding: 8px;
    }

    .brand-name {
        font-size: 18pt;
    }

    main {
        margin-top: 120px;
    }

    #header-actions {
        position: absolute;
        top: 10px;
        right: 10px;
    }

    .notification {
        min-width: 80%;
        max-width: 90%;
    }

    .action-button {
        width: 100%;
        font-size: 22pt;
    }

    .controls-container {
        max-width: 100%;
        padding: 0 60px 0 0;
        /* Adjust padding for mobile */
    }

    .refresh-button {
        width: 45px;
        height: 45px;
        right: 5px;
    }

    .refresh-button svg {
        width: 20px;
        height: 20px;
    }
}