/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.2rem;
    color: #7f8c8d;
    font-weight: 400;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.card-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

.card-content {
    padding: 25px;
}

/* Calculator Section */
.calculator-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 1.1rem;
    text-align: right;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 15px 25px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Results Styles */
.results-card {
    border: 2px solid #28a745;
}

.results-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-radius: 10px;
    font-weight: 600;
}

.original-amount {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.taxe-amount {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.total-amount {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: 3px solid #1e8449;
    font-size: 1.1rem;
}

.result-item .label {
    font-size: 1rem;
}

.result-item .value {
    font-size: 1.3rem;
    font-weight: 700;
}

.total-amount .value {
    font-size: 1.5rem;
}

/* Words Section Styles */
.words-section {
    border-top: 2px solid #e1e8ed;
    padding-top: 20px;
    margin-top: 20px;
}

.words-item {
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    border-right: 4px solid #28a745;
}

.words-item:last-child {
    margin-bottom: 0;
}

.words-item h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.words-text {
    font-size: 1rem;
    color: #495057;
    line-height: 1.8;
    font-weight: 500;
    white-space: pre-line;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    font-family: 'Cairo', sans-serif;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.tax-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.tax-table th,
.tax-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #e1e8ed;
}

.tax-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.tax-table tr:hover {
    background-color: #f8f9fa;
}

.special-row {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    font-weight: 600;
}

.note {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    color: #856404;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .card-header {
        padding: 20px;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .container {
        padding: 15px;
    }
    
    .tax-table {
        font-size: 0.85rem;
    }
    
    .tax-table th,
    .tax-table td {
        padding: 8px;
    }
    
    .words-item {
        padding: 15px;
    }
    
    .words-text {
        font-size: 0.9rem;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .icon {
        font-size: 3rem;
    }
    
    .result-item {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .result-item .value {
        font-size: 1.2rem;
    }
    
    .total-amount .value {
        font-size: 1.3rem;
    }
    
    .words-item h3 {
        font-size: 1rem;
    }
    
    .words-text {
        font-size: 0.85rem;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-card {
    animation: fadeIn 0.5s ease-out;
}

.words-section {
    animation: fadeIn 0.7s ease-out;
}

/* Loading State */
.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-primary.loading {
    position: relative;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
