/* Modern Customer CRM Design */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Login Page Background */
.crm-login-page {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px 0;
}

.crm-history-page {
    background: #f8f9fa;
}

/* Animated Background Pattern */
.crm-bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Header */
.crm-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.header-shop-logo {
    max-height: 50px;
    max-width: 200px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.header-shop-name {
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-logout:hover {
    background: white;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.crm-history-page .container {
    max-width: 900px;
    padding: 30px 20px;
}

/* Card Styles */
.crm-card {
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: slideUp 0.5s ease;
}

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

/* Logo Section */
.crm-logo-section {
    margin-bottom: 30px;
    animation: fadeIn 0.8s ease;
}

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

.shop-logo {
    max-width: 180px;
    max-height: 100px;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.shop-name-badge h2 {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.shop-name-badge .tagline {
    font-size: 14px;
    color: #764ba2;
    font-weight: 500;
    margin: 0;
}

.crm-welcome {
    font-size: 24px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
}

.shop-subtitle {
    color: #718096;
    margin-bottom: 30px;
    font-size: 14px;
    font-weight: 400;
}

/* Form Styles */
.form-group {
    margin: 25px 0;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f7fafc;
    font-family: 'Poppins', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}


/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px);
}

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

/* Message Box */
.message-box {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 14px;
    display: none;
    animation: slideDown 0.3s ease;
    font-weight: 500;
}

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

.message-box.error {
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
    color: white;
    display: block;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

.message-box.success {
    background: linear-gradient(135deg, #68d391 0%, #48bb78 100%);
    color: white;
    display: block;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: white;
    max-width: 520px;
    margin: 60px auto;
    padding: 45px 40px;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    z-index: 1001;
    animation: zoomIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* OTP Modal Specific */
.otp-modal {
    text-align: center;
}

.otp-icon {
    margin: 0 auto 25px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.otp-icon svg {
    display: block;
    margin: 0 auto;
}

.modal-content h3 {
    margin-bottom: 12px;
    color: #1a202c;
    font-size: 28px;
    font-weight: 700;
}

.otp-sent-msg {
    color: #718096;
    margin-bottom: 35px;
    font-size: 15px;
    line-height: 1.5;
}

.otp-sent-msg strong {
    font-weight: 700;
    color: #667eea;
}

/* OTP Input Boxes */
.otp-inputs-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 30px 0;
}

.otp-box {
    width: 60px;
    height: 70px;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    background: #f7fafc;
    color: #2d3748;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Poppins', monospace;
    caret-color: #667eea;
    outline: none;
}

.otp-box:focus {
    border-color: #667eea;
    background: white;
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 24px rgba(102, 126, 234, 0.25);
}

.otp-box:not(:placeholder-shown) {
    border-color: #48bb78;
    background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
}

/* Button in OTP Modal */
.btn-verify {
    margin-top: 25px;
    font-size: 17px;
    padding: 18px 50px;
}

.resend-section {
    text-align: center;
    margin-top: 25px;
    font-size: 14px;
    color: #718096;
}

.resend-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    margin-left: 5px;
}

.resend-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.resend-link.disabled {
    color: #cbd5e0;
    pointer-events: none;
    text-decoration: none;
}

/* Vehicle Selector */
.vehicle-selector {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.vehicle-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.vehicle-selector select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f7fafc;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s;
}

.vehicle-selector select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

/* Customer Info */
.customer-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.customer-info p {
    margin: 10px 0;
    font-size: 15px;
}

.customer-info strong {
    font-weight: 600;
    margin-right: 8px;
    opacity: 0.9;
}

/* Invoice Card - New Compact Design */

.invoice-card {
    background: #ffffff;
    margin-bottom: 20px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 45px -30px rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(226, 232, 240, 0.9);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.invoice-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 26px 60px -32px rgba(15, 23, 42, 0.75);
    border-color: rgba(148, 163, 184, 0.6);
}

/* Invoice Header - Compact */
.invoice-header-new {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    padding: 16px 20px 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.invoice-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}

.invoice-number {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.invoice-date {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.vehicle-badge {
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.35);
    align-self: flex-start;
}

.invoice-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.invoice-total {
    background: rgba(15, 23, 42, 0.18);
    padding: 6px 18px;
    border-radius: 999px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.invoice-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.invoice-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #fff;
    text-decoration: none;
}

.invoice-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.75);
    color: #fff;
}

.invoice-action-btn--primary {
    background: #ffffff;
    color: #4f46e5;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(255, 255, 255, 0.28);
}

.invoice-action-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(255, 255, 255, 0.35);
}

/* Invoice Sections */
.invoice-body-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 18px;
    padding: 18px 20px 20px;
}

.invoice-body-main,
.invoice-body-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.invoice-section {
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(180deg, #f9fafc 0%, #ffffff 100%);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.invoice-body-main .invoice-section + .invoice-section {
    margin-top: 0;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    color: #4f46e5;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 12px;
}

/* Info Grid - Compact Layout */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: #f7fafc;
    border-radius: 10px;
    transition: all 0.2s;
}

.info-item:hover {
    background: #edf2f7;
}

.info-label {
    font-size: 11px;
    color: #718096;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.info-value {
    font-size: 15px;
    color: #2d3748;
    font-weight: 700;
}

.highlight-item {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    grid-column: 1 / -1;
}

.highlight-item .info-label,
.highlight-item .info-value {
    color: white;
}

/* Products List - Compact */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f7fafc;
    border-radius: 8px;
    transition: all 0.2s;
}

.product-item:hover {
    background: #edf2f7;
}

.product-name {
    font-size: 14px;
    color: #2d3748;
    font-weight: 500;
    flex: 1;
}

.product-qty {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: #667eea;
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.product-price {
    font-size: 15px;
    color: #2d3748;
    font-weight: 700;
}

/* Payment Section - Compact */
.invoice-products-section .products-list {
    gap: 6px;
}

.payment-section {
    background: linear-gradient(180deg, #f9fafc 0%, #ffffff 100%);
    padding: 18px !important;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
}

.payment-row:last-child {
    border-bottom: none;
}

.payment-row span:first-child {
    font-weight: 500;
}

.payment-row span:last-child {
    font-weight: 700;
    color: #2d3748;
}

.discount-row {
    color: #48bb78;
}

.discount-row span:last-child {
    color: #48bb78;
}

.total-row {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    margin: 12px 0 0;
    padding: 14px 0 !important;
    border-radius: 12px;
    border: none !important;
    box-shadow: 0 10px 28px -18px rgba(79, 70, 229, 0.6);
}

.total-row span {
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 700;
}

/* No Data */
.no-data {
    background: white;
    padding: 60px 30px;
    text-align: center;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.no-data p {
    color: #a0aec0;
    font-size: 16px;
    font-weight: 500;
}

/* Footer */
.crm-footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    margin-top: 30px;
}

.crm-history-page .crm-footer {
    color: #718096;
}

.crm-footer p {
    margin: 0;
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .crm-card {
        padding: 30px 20px;
    }

    .modal-content {
        margin: 30px 15px;
        padding: 35px 25px;
    }
    
    .otp-inputs-container {
        gap: 8px;
    }
    
    .otp-box {
        width: 48px;
        height: 58px;
        font-size: 26px;
        border-radius: 12px;
    }
    
    .otp-icon svg {
        width: 60px;
        height: 60px;
    }
    
    .modal-content h3 {
        font-size: 24px;
    }
    
    /* Invoice Cards Responsive */
    .invoice-header-new {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .invoice-header-actions {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .invoice-body-grid {
        grid-template-columns: 1fr;
        padding: 16px 18px 18px;
    }

    .invoice-actions {
        width: 100%;
        gap: 10px;
    }

    .invoice-action-btn {
        width: 100%;
        justify-content: center;
    }

    .vehicle-badge {
        align-self: flex-end;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .invoice-section {
        padding: 14px 16px;
    }
    
    .product-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .product-price {
        align-self: flex-end;
    }
    
    .shop-logo {
        max-width: 150px;
    }
    
    .header-shop-logo {
        max-height: 40px;
    }
    
    .header-content {
        padding: 0 15px;
    }
    
    .btn-logout {
        padding: 6px 15px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .otp-inputs-container {
        gap: 6px;
    }
    
    .otp-box {
        width: 42px;
        height: 52px;
        font-size: 24px;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 40px 20px;
    }

    .crm-card {
        padding: 50px 45px;
    }

    .modal-content {
        margin: 120px auto;
    }
}

@media (min-width: 1024px) {
    .crm-history-page .container {
        max-width: 1000px;
    }
}
