/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Login Page Styles */
.login-container {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #262845 0%, #3a3f6b 100%);
}

.logo-section {
    text-align: center;
    color: white;
    margin-bottom: 3rem;
}

.logo {
    width: 300px;
    height: 200px;
    object-fit: contain;
    margin: 0 auto 1rem;
    display: block;
}

.logo-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.subtitle {
    font-size: 1.4rem;
    opacity: 0.95;
    font-weight: 500;
    margin-bottom: 1rem;
}

.description {
    font-size: 1rem;
    opacity: 0.85;
    font-weight: 400;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

.login-form {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
}

.login-form h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #262845;
}

.login-description {
    color: #666;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.divider {
    text-align: center;
    position: relative;
    margin: 1rem 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.divider span {
    background: white;
    padding: 0 1rem;
    color: #666;
    font-size: 0.9rem;
}

/* Form Styles */
input[type="email"],
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    margin-bottom: 1rem;
}

input[type="email"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #262845;
}

/* Consent Checkbox Styles */
.consent-checkbox {
    margin: 1.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #555;
    position: relative;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 18px;
    width: 18px;
    margin: 0;
    top: 0.125rem;
    left: 0;
    z-index: 1;
}

.checkbox-label:hover {
    color: #333;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: #262845;
    border-color: #262845;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    display: block;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    background-color: white;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 0.125rem;
    z-index: 0;
}

.checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 18px;
    width: 18px;
    margin: 0;
}

/* Privacy Policy Link Styles */
.privacy-notice {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.privacy-link {
    color: #262845;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.privacy-link:hover {
    color: #1e2238;
    text-decoration: underline;
}

/* Button Styles */
.btn-primary {
    background: #262845;
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
}

.btn-primary:hover {
    background: #1e2238;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #262845;
    border: 2px solid #262845;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #262845;
    color: white;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.btn-remove {
    background: #ff4757;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.btn-remove:hover {
    background: #ff3742;
}

/* Header Styles */
.header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.header-logo {
    width: 280px;
    height: 56px;
    object-fit: contain;
    flex-shrink: 0;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.user-info {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.welcome-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.welcome-section h2 {
    color: #262845;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.welcome-section p {
    color: #666;
    font-size: 1rem;
    line-height: 1.7;
}

/* Audit Methods */
.audit-methods {
    margin-bottom: 2rem;
}

.audit-methods h3 {
    color: #262845;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.method-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.method-card h4 {
    color: #262845;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.method-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Expandable Method Card Styles */
.method-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s ease;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 8px;
}

.method-header:hover {
    background-color: #f8f9fa;
}

.method-header h4,
.method-header p {
    margin-bottom: 0;
    flex: 1;
}

.method-header h4 {
    margin-right: 1rem;
}

.expand-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.expand-toggle:hover {
    background-color: #e9ecef;
}

.expand-icon {
    font-size: 1.2rem;
    color: #666;
    transition: transform 0.3s ease;
    user-select: none;
}

.expand-icon.expanded {
    transform: rotate(180deg);
}

.method-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 0;
    opacity: 0;
}

.method-content.expanded {
    max-height: 2000px;
    opacity: 1;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #262845;
}

.upload-area.dragover {
    border-color: #262845;
    background: #f8f9ff;
}

.upload-content p {
    color: #666;
    margin-bottom: 1rem;
}

.uploaded-files {
    margin-top: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.file-name {
    font-weight: 500;
    color: #262845;
}

.file-size {
    color: #666;
    font-size: 0.9rem;
}

/* Form Sections */
.form-section {
    margin-bottom: 1.5rem;
}

.form-section label {
    display: block;
    font-weight: 500;
    color: #262845;
    margin-bottom: 0.5rem;
}

.product-list {
    margin-bottom: 1rem;
}

.product-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.product-name,
.product-quantity,
.product-price {
    margin-bottom: 0;
}

/* Product Management Styles */
.product-form {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    margin-bottom: 2rem;
}

.product-form h5 {
    margin-bottom: 1.5rem;
    color: #262845;
    font-size: 1.1rem;
    font-weight: 600;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    flex: 1 1 100%;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #262845;
    box-shadow: 0 0 0 3px rgba(38, 40, 69, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.products-overview {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.products-overview h5 {
    margin-bottom: 1.5rem;
    color: #262845;
    font-size: 1.1rem;
    font-weight: 600;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.no-products {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

.product-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.product-card:hover {
    border-color: #262845;
    box-shadow: 0 2px 8px rgba(38, 40, 69, 0.1);
}

.product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.product-name-display {
    font-weight: 600;
    color: #262845;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.product-supplier {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.product-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.product-detail {
    font-size: 0.85rem;
    color: #555;
}

.product-detail strong {
    color: #333;
}

.product-url {
    margin-top: 0.5rem;
}

.product-url a {
    color: #262845;
    text-decoration: none;
    font-size: 0.85rem;
}

.product-url a:hover {
    text-decoration: underline;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-edit {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-edit:hover {
    background: #0056b3;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

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

/* Chat Styles */
.chat-container {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 80%;
}

.chat-message.user {
    background: #262845;
    color: white;
    margin-left: auto;
}

.chat-message.bot {
    background: white;
    border: 1px solid #e0e0e0;
}

.chat-input {
    display: flex;
    padding: 1rem;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input input {
    flex: 1;
    margin-right: 0.75rem;
    margin-bottom: 0;
}

.chat-input button {
    width: auto;
    padding: 0.875rem 1.5rem;
}

.summary-item {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.summary-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.summary-label {
    font-weight: 500;
    color: #262845;
}

.summary-value {
    color: #666;
    margin-top: 0.25rem;
}

/* Submit Section */
.submit-section {
    text-align: center;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.submit-comment {
    margin-bottom: 2rem;
    text-align: left;
}

.submit-comment h4 {
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.comment-label {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.submit-comment textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

.submit-comment textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.submit-note {
    color: #666;
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Notification Styles */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.notification {
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.notification.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 0.75rem;
}

.notification-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
    font-weight: 500;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Mobile-specific improvements for inputs */
    input[type="email"],
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Ensure buttons are large enough for touch */
    button, .btn-primary, .btn-secondary, .btn-remove, .btn-edit, .btn-delete {
        min-height: 44px;
    }

    .login-container {
        padding: 1rem;
        min-height: 100vh;
    }
    
    .login-form {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%;
    }

    .logo {
        width: 250px;
        height: 150px;
    }
    
    .main-content {
        padding: 1rem;
    }

    .welcome-section {
        padding: 1.5rem;
    }

    .welcome-section h2 {
        font-size: 1.4rem;
    }
    
    .header {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .header-left {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .header-logo {
        width: 180px;
        height: 36px;
    }

    .header-right span {
        font-size: 0.85rem;
    }

    .header .btn-secondary {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .method-card {
        padding: 1.5rem;
    }

    .method-card h4 {
        font-size: 1.1rem;
    }

    .upload-area {
        padding: 1.5rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .product-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .product-card {
        padding: 1rem;
    }

    .product-details {
        grid-template-columns: 1fr;
    }

    .product-actions {
        flex-direction: column;
    }

    .product-actions .btn-edit,
    .product-actions .btn-delete {
        width: 100%;
    }
    
    .chat-input {
        flex-direction: column;
    }
    
    .chat-input input {
        margin-right: 0;
        margin-bottom: 0.75rem;
    }

    .submit-section {
        padding: 1.5rem;
    }

    .submit-comment textarea {
        font-size: 0.9rem;
    }

    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .notification-container {
        left: 10px;
        right: 10px;
        max-width: none;
        top: 10px;
    }

    .notification {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .login-form {
        padding: 1rem;
    }

    .logo {
        width: 200px;
        height: 120px;
    }

    .login-description {
        font-size: 0.9rem;
    }

    .header {
        padding: 0.75rem;
    }

    .header-left {
        margin-bottom: 0.5rem;
    }

    .header-right {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .header .btn-secondary {
        width: 100%;
    }

    .header-logo {
        width: 150px;
        height: 30px;
    }

    .main-content {
        padding: 0.75rem;
    }

    .welcome-section,
    .method-card,
    .submit-section {
        padding: 1rem;
    }

    .method-card h4 {
        font-size: 1rem;
    }

    .audit-methods h3 {
        font-size: 1.2rem;
    }

    .product-form,
    .products-overview {
        padding: 1rem;
    }

    input[type="email"],
    input[type="text"],
    input[type="number"],
    select {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .checkbox-label {
        font-size: 0.85rem;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .btn-remove {
        width: 100%;
        border-radius: 6px;
        height: 38px;
    }

    .upload-content p {
        font-size: 0.9rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #262845;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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