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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #ae5294 0%, #5669ab 40%, #059fd6 70%, #2da5dd 100%);
    min-height: 100vh;
    color: #333;
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

.container {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.form-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

h2 {
    font-size: 28px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
}

.subtitle {
    color: #718096;
    margin-bottom: 32px;
    font-size: 16px;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: #f7fafc;
}

.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-container input[type="password"],
.password-input-container input[type="text"] {
    padding-right: 45px;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #718096;
    font-size: 18px;
    padding: 8px;
    z-index: 10;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-btn:active {
    transform: scale(0.95);
}

input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

input[type="password"]::-webkit-textfield-decoration-container {
    display: none;
}

input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
}

input[type="password"]::-webkit-strong-password-auto-fill-button {
    display: none !important;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #4299e1;
    background: white;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

#clientNameGroup {
    transition: all 0.3s ease;
}

#clientNameGroup input[readonly] {
    background-color: #f7fafc;
    color: #2d3748;
    font-weight: 500;
    cursor: default;
}

#addClientDni[readonly] {
    background-color: #f7fafc;
    color: #2d3748;
    font-weight: 500;
    cursor: default;
}

#clientDetailsGroup {
    transition: all 0.3s ease;
}

.quantity-price-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.form-group-half {
    flex: 1;
    text-align: left;
}

.form-group-third {
    flex: 1;
    text-align: left;
}

#clientPrice {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
    color: #2d3748;
    font-weight: 600;
    text-align: center;
    font-size: 16px;
    cursor: default;
}

#clientPrice:focus {
    outline: none;
    box-shadow: none;
}

.quantity-container {
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
    overflow: hidden;
}

.quantity-btn {
    width: 40px;
    height: 48px;
    border: none;
    background: #4299e1;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s ease;
}

.quantity-btn:hover {
    background: #3182ce;
}

.quantity-btn:active {
    background: #2c5aa0;
}

#clientQuantity {
    flex: 1;
    border: none;
    padding: 14px 16px;
    text-align: center;
    font-weight: 600;
    background: transparent;
    font-size: 16px;
}

#clientQuantity:focus {
    outline: none;
    box-shadow: none;
}

.quantity-container.full-width {
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
    overflow: hidden;
    width: 100%;
}

.quantity-container.full-width input {
    flex: 1;
    border: none;
    padding: 14px 16px;
    text-align: center;
    font-weight: 600;
    background: transparent;
    font-size: 16px;
}

.quantity-container.full-width input:focus {
    outline: none;
    box-shadow: none;
}

.payment-status-container {
    position: relative;
}

#paymentStatus {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
    color: #2d3748;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#paymentStatus:hover {
    border-color: #4299e1;
    background: white;
}

#paymentStatus:focus {
    outline: none;
    border-color: #4299e1;
    background: white;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.payment-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.payment-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

.payment-option:hover {
    background: #f7fafc;
}

.payment-option:active {
    background: #e2e8f0;
}

.payment-option[data-value="Payment"] {
    color: #22543d;
}

.payment-option[data-value="No Payment"] {
    color: #c53030;
}

.payment-method-container {
    position: relative;
}

#paymentMethod {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
    color: #2d3748;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#paymentMethod:disabled {
    background: #e2e8f0;
    color: #a0aec0;
    cursor: not-allowed;
    border-color: #cbd5e0;
}

#paymentMethod:not(:disabled):hover {
    border-color: #4299e1;
    background: white;
}

#paymentMethod:not(:disabled):focus {
    outline: none;
    border-color: #4299e1;
    background: white;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.payment-method-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.payment-method-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

.payment-method-option:hover {
    background: #f7fafc;
}

.payment-method-option:active {
    background: #e2e8f0;
}

.payment-row {
    margin-bottom: 20px;
}

.primary-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.save-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.save-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
}

.save-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

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

.demo-credentials {
    margin-top: 24px;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
    text-align: left;
}

.demo-credentials h4 {
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 14px;
}

.demo-credentials p {
    color: #718096;
    font-size: 13px;
    margin-bottom: 4px;
}

.credential {
    color: #2d3748;
    font-weight: 600;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: #fed7d7;
    color: #c53030;
    border-radius: 8px;
    font-size: 14px;
}

.header {
    background: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    font-size: 20px;
}

.profile-pic {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e2e8f0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-details h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 2px;
}

.user-details p {
    font-size: 14px;
    color: #718096;
}

.logout-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #f7fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #718096;
    font-size: 18px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #e2e8f0;
    color: #4a5568;
}

#searchScreen .container {
    padding-top: 40px;
}

.form-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 20px;
}

.form-actions:first-of-type {
    margin-top: 20px;
}

.search-result {
    margin-top: 0;
    width: 100%;
}

.error-message-search {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    font-weight: 600;
    min-height: 48px;
    margin-bottom: 16px;
}

.search-result .save-btn {
    margin-bottom: 0;
}

.error-message-search i {
    font-size: 20px;
}

.error-message-search p {
    margin: 0;
    font-weight: 500;
}

@media (max-width: 480px) {
    .container {
        padding: 16px;
    }

    .form-card {
        padding: 24px;
        border-radius: 12px;
    }

    h2 {
        font-size: 24px;
    }

    .header {
        padding: 12px 16px;
    }

    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .profile-pic {
        width: 40px;
        height: 40px;
        border-width: 2px;
    }

    .user-details h3 {
        font-size: 15px;
    }

    .user-details p {
        font-size: 13px;
    }

    .form-group-row,
    .quantity-price-row,
    .payment-row {
        flex-direction: row; 
        gap: 12px; 
    }

    .form-group-half,
    .form-group-third {
        flex: 1; 
    }

    .quantity-btn {
        width: 32px; 
        height: 40px;
        font-size: 14px;
    }

    input[type="text"],
    input[type="password"] {
        padding: 12px 14px;
        font-size: 14px;
    }

    #clientQuantity {
        padding: 12px 8px; 
        font-size: 14px;
    }

    #clientPrice,
    #paymentMethod {
        padding: 12px 14px;
        font-size: 14px;
    }

    .form-actions {
        margin-top: 16px;
    }

    .error-message-search {
        padding: 12px 16px;
        font-size: 14px;
    }

    .quantity-container.full-width input {
        padding: 12px 8px;
        font-size: 14px;
    }
}

@supports (-webkit-touch-callout: none) {
    .container {
        min-height: -webkit-fill-available;
    }
}

.remark-section {
    margin-top: 20px;
    width: 100%;
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    cursor: pointer;
}

.modern-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #2d3748;
    font-size: 16px;
    font-weight: 500;
    user-select: none;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    color: #1a202c;
    transform: translateX(2px);
}

.checkbox-custom {
    position: relative;
    width: 24px;
    height: 24px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.checkbox-label:hover .checkbox-custom {
    border-color: #cbd5e0;
    background: #edf2f7;
    transform: scale(1.05);
}

.modern-checkbox:checked + .checkbox-label .checkbox-custom {
    background: rgb(63, 149, 222);
    border-color: rgb(49, 130, 206);
}

.modern-checkbox:checked + .checkbox-label .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    animation: checkmark 0.3s ease-in-out;
}

@keyframes checkmark {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.remark-text-group {
    width: 100%;
    margin-top: 16px;
    animation: slideDown 0.4s ease-out;
}

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

#remarkText {
    width: 100%;
    min-height: 80px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    color: #2d3748;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

#remarkText::placeholder {
    color: #a0aec0;
    font-style: italic;
}

#remarkText:focus {
    outline: none;
    border-color: rgb(63, 149, 222);
    background: #ffffff;
    transform: translateY(-2px);
}

#okModalBtn:hover {
    background-color: #218838 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#okModalBtn:active {
    transform: translateY(0);
    background-color: #1e7e34 !important;
}

#successModal {
    animation: modalFadeIn 0.3s ease-out;
}

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