:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --background-color: #f3f4f6;
    --surface-color: #ffffff;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --danger-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background-color: var(--surface-color);
    border-right:1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar .header {
    padding: 20px;
    border-bottom:1px solid var(--border-color);
    background-color: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar .header h2 {
    font-size: 1.25rem;
    color: var(--text-color);
}

.admin-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.admin-link:hover {
    background-color: #dbeafe;
}

.product-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.product-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s;
    cursor: pointer;
}

.product-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-card h3 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.product-card p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.product-card .price {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.btn-add {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background-color: #eff6ff;
    color: var(--primary-color);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-add:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 70px;
    background-color: var(--surface-color);
    border-bottom:1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.currency-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 20px;
}

.currency-selector label {
    font-weight: 500;
    color: #374151;
}

.currency-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    background-color: white;
    transition: border-color 0.2s;
}

.currency-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Quote Paper */
.quote-paper {
    flex: 1;
    margin: 40px auto;
    width: 210mm; /* A4 width */
    height: auto;
    min-height: 297mm; /* A4 height */
    background-color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 20mm;
    overflow-y: auto;
    color: #374151;
}

.paper-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 20px;
}

.company-info h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.company-logo {
    max-width: 300px;
    height: auto;
    display: block;
}

.quote-meta {
    text-align: right;
}

.customer-info {
    margin-bottom: 30px;
}

.quote-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.quote-table th, .quote-table td {
    padding: 12px;
    border-bottom:1px solid var(--border-color);
    text-align: left;
}

.quote-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quote-item-image {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.quote-item-details {
    flex: 1;
}

.quote-table th {
    background-color: #f9fafb;
    font-weight: 600;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

.remove-btn {
    color: var(--danger-color);
    background: none;
    border: none;
    cursor: pointer;
    font-size:1.1rem;
}

.total-row {
    font-size: 1.1rem;
    color: var(--primary-color);
}

.paper-footer {
    margin-top: 50px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.footer-notes {
    flex: 1;
    margin-right: 40px;
}

.footer-notes p {
    margin-bottom: 10px;
    color: #374151;
}

.footer-notes ul {
    margin: 0;
    padding-left: 20px;
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.6;
}

.footer-notes li {
    margin-bottom: 5px;
}

.signature-box {
    text-align: center;
    width: 200px;
}

.signature-line {
    border-top: 1px solid #000;
    margin-top: 40px;
}

/* Scrollbar for paper view */
.main-content {
    overflow-y: auto;
}

@media print {
    .sidebar, .top-bar {
        display: none;
    }
    .app-container {
        display: block;
        height: auto;
    }
    .main-content {
        overflow: visible;
    }
    .quote-paper {
        margin: 0;
        box-shadow: none;
        width: 100%;
        height: auto;
    }
}

/* History Modal */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.history-modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #f9fafb;
}

.history-modal-header h3 {
    margin: 0;
    color: var(--text-color);
}

.close-modal {
    background: none;
    border: none;
    font-size:1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #374151;
}

.history-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.history-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.btn-load-quote {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.btn-load-quote:hover {
    background-color: var(--secondary-color);
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    padding: 50px 40px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity:1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h2 {
    font-size: 1.75rem;
    color: var(--text-color);
    margin-bottom: 10px;
    font-weight: 700;
}

.login-header p {
    color: #6b7280;
    font-size: 0.95rem;
}

.login-header .logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.login-header .logo-icon i {
    font-size: 2rem;
    color: white;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-form .form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
}

.login-form .form-group input {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #f9fafb;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.login-form .form-group input::placeholder {
    color: #9ca3af;
}

.login-form .login-btn {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.login-form .login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.login-form .login-btn:active {
    transform: translateY(0);
}

.login-form .login-btn i {
    margin-right: 8px;
}

.error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    color: #9ca3af;
    font-size: 0.85rem;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 480px) {
    .login-card {
        padding: 35px 25px;
    }
    
    .login-header h2 {
        font-size: 1.5rem;
    }
}
