/* Antalgija Sales System Styles */

:root {
    --primary-color: #249a48;
    --secondary-color: #156132;
    --accent-color: #ca9b5e;
    --text-color: #1f2a24;
    --bg-color: #f5f3ef;
    --white: #ffffff;
    --border-color: #e5e0d7;
    --error-color: #d32f2f;
    --success-color: #2e7d32;
}

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

body {
    font-family: 'Rethink Sans', Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

.header h1 {
    font-family: 'Sora', Arial, sans-serif;
    color: var(--primary-color);
    font-size: 28px;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--accent-color);
    color: white;
}

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

.btn-remove {
    background-color: var(--error-color);
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #ffebee;
    border-left: 4px solid var(--error-color);
    color: #c62828;
}

.alert-success {
    background-color: #e8f5e9;
    border-left: 4px solid var(--success-color);
    color: #2e7d32;
}

.alert ul {
    margin-left: 20px;
}

/* Forms */
.proposal-form {
    background: var(--white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    color: var(--secondary-color);
    font-size: 20px;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(36, 154, 72, 0.1);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/* Service Search */
.service-search {
    position: relative;
    margin-bottom: 20px;
}

.service-search input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.service-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none; /* Hidden by default, shown via JavaScript */
}

.service-result-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.service-result-item:hover {
    background-color: #f5f3ef;
}

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

.no-results {
    padding: 20px;
    text-align: center;
    color: #999;
}

/* Category Tabs */
.category-tabs-container {
    margin-top: 20px;
}

.category-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.category-tab,
.subcategory-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.category-tab:hover,
.subcategory-tab:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.category-tab.active,
.subcategory-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.subcategory-nav {
    margin-bottom: 15px;
}

#subcategory-breadcrumb {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.subcategory-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#category-services-container {
    margin-top: 20px;
}

#category-services-table {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

#category-services-table .services-table {
    margin: 0;
}

#category-services-table .services-table tbody tr:hover {
    background-color: #f5f5f5;
    cursor: pointer;
}

/* Services Table */
.selected-services {
    margin-top: 20px;
}

.services-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.services-table thead {
    background-color: var(--primary-color);
    color: white;
}

.services-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.services-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.services-table td:nth-child(1),
.services-table td:nth-child(2) {
    text-align: left;
    white-space: normal; /* Allow wrapping for code and name */
}

.services-table td:nth-child(3) {
    text-align: center;
    white-space: nowrap;
}

.services-table td:nth-child(4),
.services-table td:nth-child(5),
.services-table td:nth-child(6) {
    text-align: right;
    white-space: nowrap; /* Prevent euro symbol from wrapping */
}

.services-table td:nth-child(5) {
    text-align: center; /* Discount column */
}

.services-table tbody tr:hover {
    background-color: #f9f9f9;
}

.services-table tfoot {
    background-color: #f5f3ef;
    border-top: 2px solid var(--primary-color);
}

.services-table tfoot .summary-row {
    background-color: #f5f3ef;
}

.services-table tfoot .summary-row td {
    padding: 15px 12px;
    font-size: 16px;
    border-top: 2px solid var(--primary-color);
}

.services-table tfoot .summary-row td:first-child {
    font-weight: 600;
    color: var(--secondary-color);
}

.quantity-input {
    width: 80px;
    padding: 5px;
}

.text-center {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* Totals */
.totals-section {
    margin: 30px 0;
}

.totals-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap; /* Prevent euro symbol from wrapping */
}

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

.total-row-main {
    font-size: 18px;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid var(--primary-color);
}

.profit-margin {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

.profit-margin .negative {
    color: var(--error-color);
    font-weight: bold;
}

/* Form Actions */
.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .proposal-form {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .services-table {
        font-size: 11px;
    }

    .services-table th,
    .services-table td {
        padding: 6px 4px;
    }

    .proposal-view .services-table {
        font-size: 10px;
    }

    .proposal-view .services-table th,
    .proposal-view .services-table td {
        padding: 5px 3px;
    }

    .form-actions {
        flex-direction: column;
        gap: 15px;
    }

    .form-actions-buttons {
        width: 100%;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
    
        .proposal-header img,
    .proposal-logo {
        max-height: 180px !important;
    }
}

@media (max-width: 480px) {
    .services-table {
        font-size: 9px;
    }

    .services-table th,
    .services-table td {
        padding: 4px 2px;
    }

    .proposal-view .services-table {
        font-size: 9px;
    }

    .proposal-view .services-table th,
    .proposal-view .services-table td {
        padding: 4px 2px;
    }
    
    .proposal-header img,
    .proposal-logo {
        max-height: 150px !important;
    }
}

/* Proposal logo styling */
.proposal-logo {
    max-height: 240px;
    margin-bottom: 20px;
    width: auto;
}

/* Admin Dashboard Styles */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-card .stat-subvalue {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    font-weight: normal;
}

.proposals-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
}

.proposals-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.proposals-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-draft { background: #e0e0e0; color: #666; }
.status-sent { background: #e3f2fd; color: #1976d2; }
.status-viewed { background: #fff3e0; color: #f57c00; }
.status-paid { background: #e8f5e9; color: #2e7d32; }
.status-expired { background: #ffebee; color: #c62828; }
.status-cancelled { background: #f3e5f5; color: #7b1fa2; }

/* Customer Proposal View */
.proposal-view {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.proposal-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

.proposal-header h1 {
    color: var(--primary-color);
    font-size: 32px;
    margin-bottom: 10px;
}

.proposal-header p {
    margin-top: 10px;
    color: var(--text-color);
    font-size: 16px;
}

.expiry-notice {
    background: #fff3e0;
    border-left: 4px solid #f57c00;
    padding: 15px;
    margin: 20px 0;
    border-radius: 6px;
}

.payment-options {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.payment-option {
    background: #f9f9f9;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.payment-option h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

