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

body {
    font-family: 'Segoe UI', 'Arial', 'Tahoma', sans-serif;
    background-color: #eef1f5;
    padding: 20px;
    direction: rtl;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== Controls Section ===== */
.controls {
    background: linear-gradient(135deg, #1e2a3a 0%, #2c3e50 100%);
    color: white;
    padding: 18px 24px;
    border-radius: 10px;
    margin-bottom: 24px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.controls-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.controls-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
}

.controls-header h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.controls-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.controls-info {
    background-color: rgba(255,255,255,0.08);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid rgba(255,255,255,0.1);
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary {
    background-color: #FF6633;
    color: white;
}

.btn-primary:hover {
    background-color: #e55a2b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,102,51,0.4);
}

.btn-secondary {
    background-color: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

/* ===== Main Container ===== */
.container {
    background-color: white;
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 44px;
    box-shadow: 0 2px 30px rgba(0,0,0,0.08);
    position: relative;
    border-radius: 2px;
}

/* ===== Section Wrapper ===== */
.section-wrapper {
    position: relative;
    margin-bottom: 8px;
    padding: 10px;
    border: 2px dashed transparent;
    border-radius: 6px;
    transition: all 0.25s ease;
}

.section-wrapper:hover {
    border-color: #FF6633;
    background-color: rgba(255,102,51,0.02);
}

.section-wrapper:hover .section-controls {
    opacity: 1;
    pointer-events: auto;
}

/* ===== Section Controls ===== */
.section-controls {
    position: absolute;
    left: -56px;
    top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 10;
}

.move-btn,
.delete-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.move-btn {
    background-color: #3498db;
    color: white;
}

.move-btn:hover {
    background-color: #2980b9;
    transform: scale(1.1);
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background-color: #c0392b;
    transform: scale(1.1);
}

/* ===== Row Actions ===== */
.row-actions {
    width: 36px;
    text-align: center;
    vertical-align: middle;
}

.delete-row-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background-color: #e74c3c;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.delete-row-btn:hover {
    background-color: #c0392b;
    transform: scale(1.15);
    opacity: 1;
}

/* ===== Editable Fields ===== */
.editable {
    transition: background-color 0.2s, box-shadow 0.2s;
    padding: 3px 5px;
    border-radius: 3px;
}

.editable:hover {
    background-color: #fffbf0;
    box-shadow: 0 0 0 2px rgba(255,102,51,0.15);
}

.editable:focus {
    outline: none;
    background-color: #fffaed;
    box-shadow: 0 0 0 2px rgba(255,102,51,0.4);
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #FF6633;
    padding-bottom: 20px;
    margin-bottom: 28px;
    gap: 20px;
}

.logo-section {
    text-align: left;
    flex-shrink: 0;
}

.logo {
    max-width: 130px;
    height: auto;
    display: block;
}

.company-info {
    text-align: right;
    flex: 1;
}

.company-name {
    font-size: 22px;
    font-weight: 700;
    color: #1e2a3a;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.company-tagline {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.company-contact-mini {
    font-size: 11px;
    color: #999;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== Title ===== */
.quotation-title {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    color: #FF6633;
    margin-bottom: 28px;
    padding-bottom: 12px;
    border-bottom: 2px solid #fce4d6;
    letter-spacing: 0.5px;
}

/* ===== Quote Reference ===== */
.quote-ref {
    display: flex;
    justify-content: space-between;
    background-color: #fafafa;
    padding: 16px 20px;
    margin-bottom: 28px;
    border-right: 4px solid #FF6633;
    border-radius: 0 6px 6px 0;
    gap: 12px;
}

.quote-item {
    flex: 1;
}

.quote-label {
    font-weight: 700;
    color: #1e2a3a;
    margin-bottom: 4px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.quote-value {
    color: #555;
    font-size: 14px;
}

/* ===== Client Info ===== */
.client-info {
    margin-bottom: 28px;
    background: linear-gradient(135deg, #f0f7ff 0%, #f8fbff 100%);
    padding: 22px;
    border-radius: 6px;
    border: 1px solid #e0edf8;
}

/* ===== Section Title ===== */
.section-title {
    font-size: 17px;
    font-weight: 700;
    color: #FF6633;
    margin-top: 28px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #FF6633;
    letter-spacing: 0.3px;
}

/* ===== Info Table ===== */
.info-table {
    width: 100%;
    margin-bottom: 16px;
}

.info-table tr td:first-child {
    font-weight: 700;
    width: 30%;
    color: #1e2a3a;
    padding: 8px 0;
    font-size: 13px;
}

.info-table tr td {
    padding: 8px 0;
    border-bottom: 1px solid #eef2f7;
    font-size: 14px;
}

/* ===== Pricing Table ===== */
.pricing-table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    font-size: 13px;
}

.pricing-table thead {
    background: linear-gradient(135deg, #FF6633 0%, #ff7a4d 100%);
    color: white;
}

.pricing-table th {
    padding: 12px 14px;
    text-align: right;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.pricing-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #eef2f7;
    text-align: right;
    vertical-align: middle;
}

.pricing-table tbody tr:hover {
    background-color: #fafbfc;
}

.pricing-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.pricing-table .price {
    color: #FF6633;
    font-weight: 700;
    font-size: 14px;
}

/* ===== Totals ===== */
.totals {
    width: 100%;
    margin-top: 24px;
}

.total-row {
    display: flex;
    justify-content: flex-start;
    padding: 12px 16px;
    font-size: 15px;
    border-bottom: 1px solid #eef2f7;
}

.total-label {
    width: 60%;
    text-align: left;
    font-weight: 700;
    color: #1e2a3a;
}

.total-amount {
    width: 40%;
    text-align: left;
    color: #FF6633;
    font-weight: 700;
}

.total-row.grand-total {
    background: linear-gradient(135deg, #FF6633 0%, #ff7a4d 100%);
    color: white;
    font-size: 17px;
    border-radius: 6px;
    margin-top: 6px;
    border: none;
}

.total-row.grand-total .total-label,
.total-row.grand-total .total-amount {
    color: white;
}

/* ===== Timeline ===== */
.timeline {
    margin: 18px 0;
}

.timeline-item {
    display: flex;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef2f7;
    position: relative;
    align-items: flex-start;
    gap: 8px;
}

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

.timeline-phase {
    width: 30%;
    font-weight: 700;
    color: #FF6633;
    font-size: 13px;
}

.timeline-duration {
    width: 25%;
    color: #666;
    font-size: 13px;
}

.timeline-description {
    width: 40%;
    color: #444;
    font-size: 13px;
}

/* ===== Services List ===== */
.services-list {
    list-style-position: inside;
    margin: 12px 0;
}

.services-list li {
    padding: 7px 0;
    line-height: 1.6;
    font-size: 13px;
}

/* ===== Contact Section ===== */
.contact-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 18px 0;
}

.contact-box {
    background-color: #fafbfc;
    padding: 20px;
    border-radius: 6px;
    border-right: 3px solid #FF6633;
    border: 1px solid #eef2f7;
    border-right: 3px solid #FF6633;
}

.contact-title {
    font-size: 15px;
    font-weight: 700;
    color: #FF6633;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef2f7;
}

.contact-detail {
    padding: 6px 0;
    color: #444;
    font-size: 13px;
}

/* ===== Terms Section ===== */
.terms-section {
    background-color: #fafbfc;
    padding: 20px;
    border-radius: 6px;
    border-right: 4px solid #FF6633;
    border: 1px solid #eef2f7;
    border-right: 4px solid #FF6633;
}

.terms-list {
    list-style-position: inside;
}

.terms-list li {
    padding: 8px 0;
    line-height: 1.7;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.terms-list li:last-child {
    border-bottom: none;
}

/* ===== Signature Section ===== */
.signature-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 50px;
}

.signature-box {
    border: 2px solid #dde2e8;
    padding: 24px;
    border-radius: 6px;
    text-align: center;
    min-height: 120px;
}

.signature-title {
    font-size: 15px;
    font-weight: 700;
    color: #FF6633;
    margin-bottom: 16px;
}

/* ===== Footer ===== */
.footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 2px solid #eef2f7;
    text-align: center;
    color: #888;
    font-size: 11px;
}

.footer-logo {
    width: 48px;
    height: auto;
    margin-bottom: 8px;
    opacity: 0.8;
}

.footer p {
    margin: 4px 0;
    line-height: 1.5;
}

/* ===== Responsive Design ===== */

/* Tablet */
@media (max-width: 960px) {
    .section-controls {
        position: relative;
        left: 0;
        flex-direction: row;
        margin-bottom: 8px;
        opacity: 1;
        pointer-events: auto;
    }

    .container {
        padding: 32px 28px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 24px 18px;
    }

    .controls {
        padding: 14px 16px;
    }

    .controls-header {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-brand {
        justify-content: center;
    }

    .controls-actions {
        justify-content: center;
    }

    /* Header responsive */
    .header {
        flex-direction: column-reverse;
        text-align: center;
        gap: 16px;
    }

    .company-info {
        text-align: center;
    }

    .company-contact-mini {
        justify-content: center;
    }

    .logo-section {
        text-align: center;
    }

    .logo {
        max-width: 110px;
        margin: 0 auto;
    }

    /* Quote ref responsive */
    .quote-ref {
        flex-direction: column;
        gap: 12px;
    }

    /* Grid sections responsive */
    .contact-section,
    .signature-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Section controls always visible */
    .section-controls {
        position: relative;
        left: 0;
        flex-direction: row;
        margin-bottom: 8px;
        opacity: 1;
        pointer-events: auto;
    }

    .move-btn,
    .delete-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    /* Timeline responsive */
    .timeline-item {
        flex-direction: column;
        gap: 4px;
    }

    .timeline-phase,
    .timeline-duration,
    .timeline-description {
        width: 100%;
    }

    /* Pricing table responsive */
    .pricing-table {
        font-size: 11px;
    }

    .pricing-table th,
    .pricing-table td {
        padding: 8px 6px;
    }

    /* Totals responsive */
    .total-row {
        font-size: 13px;
        padding: 10px 12px;
    }

    .total-row.grand-total {
        font-size: 15px;
    }

    .quotation-title {
        font-size: 20px;
    }

    .section-title {
        font-size: 15px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 16px 12px;
    }

    .company-name {
        font-size: 18px;
    }

    .quotation-title {
        font-size: 18px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .pricing-table {
        font-size: 10px;
    }

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

    .total-label,
    .total-amount {
        font-size: 12px;
    }

    .info-table tr td:first-child {
        width: 40%;
    }
}

/* Very small screens - pricing table scroll */
@media (max-width: 400px) {
    .pricing-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
