@font-face {
    font-family: YekanBakh;
    src: url('/assets/fonts/YekanBakh[wght].woff2') format('woff2');
    font-weight: 100 200 300 400 500 600 700 800 900;
    font-display: swap;
    font-style: normal;
}

:root {
    --primary-color: #d4af37;
    --primary-dark: #b8941f;
    --secondary-color: #f8f9fa;
    --accent-color: #ffd700;
    --text-color: #333;
    --border-color: #ddd;
    --error-color: #e74c3c;
    --success-color: #2ecc71;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --skeleton-color: #e0e0e0;
    --skeleton-highlight: #f5f5f5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'YekanBakh', Tahoma, sans-serif;
}

body {
    /* background-color: #f5f7fa; */
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    /* padding: 5px; */
}

#initialLoading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.initial-loading-content {
    text-align: center;
    color: white;
}

.initial-loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin .625s ease-out infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--skeleton-color) 25%, var(--skeleton-highlight) 50%, var(--skeleton-color) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

#exchangeRateSkeleton {
    width: 100%;
    display: flex;
}

.skeleton-input {
    width: 100%;
    height: 44px;
}

.countdownContainer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skeleton-countdown {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.countdown-circle {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.countdown-circle-bg {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 4;
}

.countdown-circle-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
    transition: stroke-dashoffset 1s linear;
}

.countdown-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
    color: var(--text-color);
}

.countdown-loading .countdown-circle-progress {
    animation: countdown-loading 1s linear infinite;
}

@keyframes countdown-loading {
    0% {
        stroke-dashoffset: 126;
    }
    50% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: -126;
    }
}

.disabled-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error-color);
    font-size: 24px;
    font-weight: bold;
    border-radius: 50%;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background-color: white;
    /* border-radius: 8px; */
    /* box-shadow: var(--shadow); */
    overflow: hidden;
    opacity: 1;
    transition: all 0.25s ease;
}

.svg-1-5 {
    width: 1.5rem;
    height: 1.5rem;
    vertical-align: middle;
}

.svg-1-25 {
    width: 1.25rem;
    height: 1.25rem;
    vertical-align: middle;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px 15px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    transform: rotate(30deg);
}

h1 {
    font-size: 22px;
    margin-bottom: 8px;
    position: relative;
}

.subtitle {
    font-size: 13px;
    opacity: 0.9;
    position: relative;
}

.content {
    display: flex;
    flex-wrap: wrap;
    padding: 15px;
}

.customer-info {
    flex: 1;
    min-width: 300px;
    padding: 15px;
    border-left: 1px solid var(--border-color);
}

.invoice-items {
    flex: 2;
    min-width: 500px;
    padding: 15px;
}

.section-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-title i {
    margin-left: 10px;
    font-size: 20px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

input,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

input:disabled {
    background: var(--secondary-color) !important;
    opacity: 0.75;
    cursor: not-allowed;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.exchange-rate {
    background-color: var(--secondary-color);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
}

.exchangeRate-inner {
    width: 50%;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: start;
}

.exchange-rate label {
    margin-bottom: 0;
    font-size: 15px;
    color: var(--text-color);
    width: fit-content;
    white-space: nowrap;
}

.exchangeRate-inner input {
    width: 100%;
    font-weight: bold;
    text-align: center;
}

.exchange-rate .auto-update {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 10px;
    font-size: 13px;
    color: #666;
}

.items-table-container {
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
}

.items-table thead {
    position: sticky;
    top: 0;
    background-color: var(--primary-color);
    color: white;
    z-index: 10;
}

.items-table th {
    padding: 12px 8px;
    text-align: start;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.items-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.items-table tbody tr:hover {
    background-color: #f9f9f9;
}

.items-table tbody tr:last-child {
    border-bottom: none;
}

.items-table td {
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
}

.items-table input,
.items-table select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    background-color: white;
}

.items-table .price-cell {
    font-weight: bold;
    /* background-color: #f8f9fa; */
}

.items-table .actions-cell {
    width: 58px;
}

.danger-action {
    cursor: pointer;
    vertical-align: middle;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error-color);
}

.danger-action:hover:not(:disabled) {
    color: #c0392b;
}

.danger-action[disabled]:hover {
    color: var(--error-color) !important;
}

.danger-action[disabled] {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

.danger-action svg {
    width: 1.375rem;
    height: 1.375rem;
}

button {
    padding: 10px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    /* transform: translateY(-1px); */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: #e9ecef;
    /* transform: translateY(-1px); */
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
    padding: 6px 10px;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c0392b;
    /* transform: translateY(-1px); */
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #27ae60;
    /* transform: translateY(-1px); */
}

.invoice-summary {
    margin-top: 20px;
    padding: 8px 16px;
    background-color: var(--secondary-color);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.summary-row:first-child {
    padding-top: 5px;
}

.summary-row:last-child {
    padding-bottom: 5px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
    padding-top: 10px;
    border-bottom: 1px dashed var(--border-color);
    font-size: 14px;
}

.summary-row.total {
    font-weight: bold;
    font-size: 16px;
    padding-top: 10px;
    border-bottom: none;
}

.actions-bar {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 14px;
}

.message.success {
    background-color: rgba(46, 204, 113, 0.15);
    border: 1px solid var(--success-color);
    color: var(--success-color);
    display: block;
}

.message.error {
    background-color: rgba(231, 76, 60, 0.15);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    display: block;
}

.message.info {
    background-color: rgba(52, 152, 219, 0.15);
    border: 1px solid #3498db;
    color: #3498db;
    display: block;
}

.message.warning {
    background-color: rgba(243, 156, 18, 0.15);
    border: 1px solid #f39c12;
    color: #f39c12;
    display: block;
}

@media (max-width: 1200px) {
    .content {
        padding: 12px;
    }
    .customer-info,
    .invoice-items {
        padding: 12px;
    }
}

@media (max-width: 992px) {
    .content {
        flex-direction: column;
    }
    .customer-info {
        border-left: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 20px;
    }
    .items-table-container {
        max-height: 350px;
    }
}

@media (max-width: 768px) {
    body {
        /* padding: 3px; */
    }
    header {
        padding: 15px 10px;
    }
    h1 {
        font-size: 20px;
    }
    .content {
        padding: 10px 8px;
    }
    .exchange-rate {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .exchange-rate .auto-update {
        width: 100%;
        justify-content: space-between;
    }
    .exchangeRate-inner {
        width: 100%;
    }
    .items-table-container {
        max-height: 300px;
    }
    .items-table th,
    .items-table td {
        padding: 8px 6px;
        font-size: 12px;
    }
    .items-table input,
    .items-table select {
        padding: 6px 8px;
        font-size: 12px;
    }
    .actions-bar {
        flex-direction: column;
    }
    .actions-bar button {
        width: 100%;
    }
    .items-table .actions-cell {
        width: 52px;
    }
    .danger-action svg {
        width: 1.25rem;
        height: 1.25rem;
    }
}

@media (max-width: 576px) {
    .customer-info,
    .invoice-items {
        min-width: 100%;
    }
    .items-table-container {
        max-height: 250px;
    }
    .items-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .items-table thead,
    .items-table tbody,
    .items-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    .countdown-circle,
    .disabled-icon {
        width: 40px;
        height: 40px;
    }
    .skeleton-countdown {
        width: 40px;
        height: 40px;
    }
    .countdown-svg {
        width: 100%;
        height: 100%;
        transform: rotate(-90deg);
    }
    .countdown-text {
        font-size: 12px;
    }
    .disabled-icon {
        font-size: 20px;
    }
}

@media (max-width: 400px) {
    header {
        padding: 12px 8px;
    }
    h1 {
        font-size: 18px;
    }
    .subtitle {
        font-size: 12px;
    }
    .content {
        padding: 8px 5px;
    }
    .customer-info,
    .invoice-items {
        padding: 8px 5px;
    }
    .section-title {
        font-size: 16px;
    }
    .form-group {
        margin-bottom: 12px;
    }
    input,
    select {
        padding: 8px 10px;
        font-size: 13px;
    }
    .skeleton-input {
        height: 38px;
    }
    .exchange-rate {
        padding: 12px;
    }
    .items-table th,
    .items-table td {
        padding: 6px 4px;
        font-size: 11px;
    }
    .items-table input,
    .items-table select {
        padding: 5px 6px;
        font-size: 11px;
    }
    button {
        padding: 8px 10px;
        font-size: 12px;
    }
    .btn-danger {
        padding: 4px 8px;
    }
    .invoice-summary {
        padding: 12px;
    }
}


/* برای پرینت قصد داشتم شبیه فاکتور واقعی در بیارم، متاسفانه فرصت نمی‌شه، پس بعداً سعی می‌کنم یه مقدار بهینه‌سازی برای حالت پرینت انجام بدم */

@media print {
    .actions-bar,
    .btn-primary,
    .actions-cell,
    .exchange-rate .auto-update {
        display: none !important;
    }
    .container {
        box-shadow: none;
    }
    .items-table tbody tr {
        background-color: white !important;
    }
}