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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f2ed;
    color: #333;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 0 40px 40px 40px;  /* No top padding - header starts at top */
}

.screen.active {
    display: block;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    width: 95%;
}

/* Header - Fixed height with three-column layout */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background-color: #B9AF9E;
    padding: 12px 20px;
    border-radius: 0 0 20px 20px;  /* No border radius - header is flush with top */
    min-height: 64px;
    max-height: 64px;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: start;
}

.header-center {
    justify-self: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

/* Header buttons - smaller to fit within header height */
.header-right .btn {
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.2;
}

.header-title {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #2d3e50;
    margin: 0;
    white-space: nowrap;
}

.header-logo {
    height: 40px;
    width: auto;
}

/* User icon dropdown */
.user-dropdown {
    position: relative;
}

.user-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2d3e50;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-icon-btn:hover {
    background: #41546a;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 220px;
    z-index: 100;
    padding: 16px;
}

.user-dropdown-menu.show {
    display: block;
}

.user-dropdown-menu .user-name {
    margin-bottom: 12px;
    font-weight: 500;
    color: #2d3e50;
    font-size: 14px;
}

.user-dropdown-menu select {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid #d2b691;
    border-radius: 6px;
    font-size: 14px;
}

.user-dropdown-menu .btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
}

/* Language dropdown */
.lang-dropdown {
    position: relative;
}

.lang-dropdown-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lang-dropdown-btn:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.lang-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    overflow: hidden;
    min-width: 180px;
}

.lang-dropdown-menu.show {
    display: block;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: background 0.2s;
}

.lang-option:hover {
    background: #f5f0e8;
}

.lang-option.selected {
    background: #e8f4fd;
    font-weight: 500;
}

/* Connection status banner */
.connection-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    text-align: center;
    font-weight: 500;
    z-index: 1000;
}

.connection-banner.offline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: #FF3B30;
    color: white;
}

.connection-banner.syncing {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: #FF9500;
    color: white;
}

.connection-banner .pending-badge {
    background: white;
    color: #FF3B30;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 18px 32px;
    border: none;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #41546a;
    color: white;
}

.btn-primary:hover {
    background: #2d3e50;
}

.btn-secondary {
    background: #7b8a99;
    color: white;
}

.btn-secondary:hover {
    background: #41546a;
}

.btn-large {
    width: 100%;
    padding: 18px;
    font-size: 18px;
}

.btn-back {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #2d3e50;
    border-radius: 8px;
    font-size: 14px;
    color: #2d3e50;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: rgba(45, 62, 80, 0.1);
}

/* Forms */
.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: #41546a;
    font-size: 20px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 24px;
    border: 2px solid #d2b691;
    border-radius: 12px;
    font-size: 20px;
}

.form-group textarea {
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

#recipient-info-group label:not(:first-child) {
    margin-top: 20px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #41546a;
}

/* Login Screen */
#login-screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

#login-screen .container {
    max-width: 400px;
    text-align: center;
}

.login-logo {
    height: 160px;
    width: auto;
    margin-bottom: 12px;
}

.tenant-name {
    font-family: 'Josefin Sans', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #2d3e50;
    margin-bottom: 30px;
    min-height: 24px;
}

#login-screen h1 {
    margin-bottom: 40px;
    font-size: 32px;
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.menu-card {
    padding: 80px 40px;
    background: white;
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
}

.menu-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.menu-card h2 {
    font-size: 36px;
    margin-bottom: 16px;
}

.menu-card p {
    color: #7b8a99;
    font-size: 22px;
}

/* Intake Screen */
.scan-area {
    background: white;
    padding: 50px;
    border-radius: 16px;
    margin-bottom: 30px;
    text-align: center;
}

.scan-area input {
    width: 100%;
    padding: 24px;
    border: 3px solid #8b6d50;
    border-radius: 12px;
    font-size: 26px;
    text-align: center;
}

.checkbox-group {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 20px;
}

.checkbox-group input[type="checkbox"] {
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.size-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.size-btn {
    padding: 20px;
    border: 3px solid #d2b691;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}

.size-btn:hover {
    border-color: #8b6d50;
    background: #f5f0e8;
}

.size-btn .size-icon {
    flex-shrink: 0;
}

.size-btn .size-info {
    flex: 1;
}

.size-btn .size-label {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.size-btn .size-examples {
    font-size: 14px;
    color: #7b8a99;
    line-height: 1.4;
}

.size-btn.selected {
    border-color: #41546a;
    background: #41546a;
}

.size-btn.selected .size-label {
    color: white;
}

.size-btn.selected .size-examples {
    color: rgba(255, 255, 255, 0.9);
}

/* Selection Buttons */
.selection-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.selection-btn {
    padding: 24px;
    border: 3px solid #d2b691;
    border-radius: 12px;
    background: white;
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.selection-btn:hover {
    border-color: #8b6d50;
    background: #f5f0e8;
}

.selection-btn.selected {
    border-color: #41546a;
    background: #41546a;
    color: white;
}

.selection-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Result Card */
.result-card {
    background: #E8F5E9;
    padding: 35px;
    border-radius: 16px;
    margin-top: 30px;
}

.result-card h3 {
    color: #2E7D32;
    margin-bottom: 20px;
    font-size: 26px;
}

.button-group {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.button-group .btn {
    flex: 1;
}

/* Error Message */
.error-message {
    background: #FFEBEE;
    color: #C62828;
    padding: 25px;
    border-radius: 12px;
    margin-top: 25px;
    display: none;
    font-size: 20px;
}

.error-message.show {
    display: block;
}

/* Loading */
#loading-screen.active {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #d2b691;
    border-top-color: #8b6d50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Admin Cards */
.admin-menu {
    display: grid;
    gap: 30px;
}

.admin-card {
    background: white;
    padding: 40px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
    width: 100%;
}

.admin-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.admin-card h3 {
    margin-bottom: 12px;
    font-size: 30px;
}

.admin-card p {
    color: #7b8a99;
    font-size: 20px;
}

/* Package List */
#packages-list, #scanned-list {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.package-item {
    padding: 20px;
    border-bottom: 2px solid #d2b691;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
}

.package-item:last-child {
    border-bottom: none;
}

.package-item.scanned {
    background: #E8F5E9;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 50px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.modal-header h2 {
    font-size: 36px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #7b8a99;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

/* Rack Management */
.rack-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rack-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.rack-header h3 {
    font-size: 20px;
}

.rack-actions {
    display: flex;
    gap: 10px;
}

.rack-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-edit {
    background: #41546a;
    color: white;
}

.btn-edit:hover {
    background: #2d3e50;
}

.btn-delete {
    background: #FF3B30;
    color: white;
}

.btn-delete:hover {
    background: #D32F2F;
}

.btn-add-column {
    background: #34C759;
    color: white;
}

.btn-add-column:hover {
    background: #28A745;
}

.columns-list {
    margin-top: 15px;
    padding-left: 20px;
}

.column-item {
    background: #f5f0e8;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.column-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    background: #6e5540;
    color: white;
}

.bins-list {
    margin-top: 10px;
    padding-left: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bin-tag {
    background: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid #d2b691;
}

.size-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
}

.size-S { background: #34C759; color: white; }
.size-M { background: #FF9500; color: white; }
.size-L { background: #FF3B30; color: white; }
.size-O { background: #AF52DE; color: white; }

/* Recipient Name-Phone Container */
.recipient-name-phone-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Responsive */
/* Tablet optimizations for 1920x1200 and similar */
@media (min-width: 1024px) and (max-width: 2000px) {
    body {
        font-size: 18px;
    }

    .container {
        max-width: 1600px;
    }

    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }

    .scan-area h2,
    .result-card h3 {
        font-size: 28px;
    }
}

/* Small screens */
@media (max-width: 600px) {
    .container {
        max-width: 100%;
    }

    .header {
        min-height: 56px;
        max-height: 56px;
        padding: 8px 12px;
    }

    .header-title {
        font-size: 14px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-logo {
        height: 32px;
    }

    .header-right .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btn-back {
        padding: 6px 12px;
        font-size: 12px;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .menu-card {
        padding: 40px 20px;
    }

    .menu-card h2 {
        font-size: 24px;
    }

    .menu-card p {
        font-size: 16px;
    }

    .size-buttons {
        grid-template-columns: 1fr;
    }

    .size-btn {
        padding: 16px;
    }

    .size-btn .size-icon {
        width: 32px;
        height: 32px;
    }

    .size-btn .size-label {
        font-size: 16px;
    }

    .size-btn .size-examples {
        font-size: 12px;
    }

    .btn {
        padding: 14px 24px;
        font-size: 16px;
    }

    .button-group {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .scan-area input {
        font-size: 20px;
        padding: 18px;
    }

    .form-group label,
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
    }

    .package-item {
        font-size: 16px;
    }

    .screen {
        padding: 0 20px 20px 20px;  /* No top padding on mobile */
    }

    #tower-unit-container,
    .recipient-name-phone-container {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }

    .user-dropdown-menu {
        min-width: 180px;
        padding: 12px;
    }

    .user-icon-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* Connection Status Indicator */
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.4);
}

.status-dot.online {
    background-color: #34C759;
    animation: pulse-green 2s infinite;
}

.status-dot.offline {
    background-color: #FF3B30;
    animation: pulse-red 2s infinite;
}

.status-dot.syncing {
    background-color: #FF9500;
    animation: pulse-yellow 1s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(52, 199, 89, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 199, 89, 0);
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(255, 59, 48, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

@keyframes pulse-yellow {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(255, 149, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 149, 0, 0);
    }
}

#connection-status {
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Status dot clone for other screens */
.status-dot-clone {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.4);
}

.status-dot-clone.online {
    background-color: #34C759;
    animation: pulse-green 2s infinite;
}

.status-dot-clone.offline {
    background-color: #FF3B30;
    animation: pulse-red 2s infinite;
}

.status-dot-clone.syncing {
    background-color: #FF9500;
    animation: pulse-yellow 1s infinite;
}

.connection-status-clone {
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Update Banner Notification */
.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #41546a 0%, #2d3e50 100%);
    color: white;
    transform: translateY(-100%);
    transition: transform 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.update-banner.visible {
    transform: translateY(0);
}

.update-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 14px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

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

.update-text {
    font-size: 16px;
    font-weight: 500;
}

.update-btn {
    background: #d2b691;
    color: #2d3e50;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.update-btn:hover {
    background: #e8dfd2;
    transform: scale(1.02);
}

.update-btn:active {
    transform: scale(0.98);
}

.update-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.update-dismiss:hover {
    color: white;
}

/* Responsive adjustments for update banner */
@media (max-width: 600px) {
    .update-banner-content {
        padding: 12px 15px;
        gap: 10px;
    }

    .update-icon {
        font-size: 18px;
    }

    .update-text {
        font-size: 14px;
    }

    .update-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .update-dismiss {
        font-size: 20px;
    }
}
