/**
 * Asset Depreciation Calculator Styles
 * Compact, Modern, Professional Design with Formula Display
 * Version: 1.3.0
 */

/* Wrapper for calculator and formula */
.asset-depreciation-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 20px auto;
    max-width: 1200px;
}

/* Main container */
.asset-depreciation-calculator {
    flex: 1;
    min-width: 320px;
    max-width: 600px;
    padding: 25px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 24, 80, 0.08);
    font-family: 'Segoe UI', Arial, sans-serif;
    border: 1px solid #eaeef5;
    position: relative;
    z-index: 1;
}

/* Formula container */
.asset-depreciation-formula {
    flex: 1;
    min-width: 320px;
    max-width: 500px;
    padding: 25px;
    background-color: #fcfcff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 24, 80, 0.08);
    font-family: 'Segoe UI', Arial, sans-serif;
    border: 1px solid #eaeef5;
    position: relative;
    z-index: 1;
}

/* Error message */
.error-message {
    background-color: #fef2f2;
    color: #b91c1c;
    border-left: 4px solid #b91c1c;
    padding: 12px;
    margin: 15px 0;
    border-radius: 4px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
}

/* Form title */
.asset-depreciation-calculator .form-title,
.asset-depreciation-formula .formula-title {
    color: #003b80;
    margin: 0 0 20px 0;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
    border-bottom: 2px solid #eaeef5;
    padding-bottom: 12px;
    position: relative;
}

.asset-depreciation-calculator .form-title:after,
.asset-depreciation-formula .formula-title:after {
    content: '';
    position: absolute;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #0056b3, #ff7f00);
    bottom: -2px;
    left: calc(50% - 40px);
    border-radius: 3px;
}

.asset-depreciation-formula .formula-title:after {
    background: linear-gradient(90deg, #0056b3, #0056b3);
}

/* Form grid layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

/* Form groups */
.form-group {
    position: relative;
}

/* Labels */
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

/* Input container with icon */
.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #0056b3;
    font-size: 14px;
}

/* Input fields */
.input-with-icon input {
    width: 100%;
    padding: 10px 10px 10px 32px;
    border: 1px solid #d9e2ec;
    border-radius: 6px;
    font-size: 14px;
    color: #2c3e50;
    background-color: #f8fafc;
    transition: all 0.3s ease;
    -webkit-appearance: none; /* Fix for iOS Safari */
}

.input-with-icon input:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
    outline: none;
    background-color: #fff;
}

.input-with-icon input:read-only {
    background-color: #edf2f7;
    border-color: #d9e2ec;
    color: #64748b;
}

.input-with-icon input::placeholder {
    color: #a0aec0;
    font-size: 13px;
}

/* Date input styling */
input[type="date"] {
    position: relative;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Date with days used group */
.date-with-days-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.days-used-display {
    margin-top: 6px;
    padding: 4px 8px;
    background-color: #ebf5ff;
    border-radius: 4px;
    color: #0056b3;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
}

#days-used-text::before {
    content: "ใช้งานแล้ว: ";
    font-weight: normal;
    color: #4c6580;
    margin-right: 3px;
}

/* Remove spinner from number inputs */
/* Chrome, Safari, Edge, Opera */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}

/* Result container */
.result-container {
    background: linear-gradient(135deg, #0056b3, #004494);
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    box-shadow: 0 4px 10px rgba(0, 86, 179, 0.2);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.result-container::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);
    z-index: 0;
}

.result-container h4 {
    color: #ffffff;
    font-size: 16px;
    margin: 0 0 8px 0;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.result-box {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 10px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.result-value {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.result-value .currency {
    font-size: 16px;
    font-weight: 400;
    margin-left: 3px;
    opacity: 0.8;
}

/* Result highlight animation */
.result-box.highlight {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.03);
}

/* Button container */
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

/* Buttons */
.calculate-btn, .save-btn {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.calculate-btn {
    background-color: #ff7f00;
    color: white;
    box-shadow: 0 3px 5px rgba(255, 127, 0, 0.2);
}

.save-btn {
    background-color: #0056b3;
    color: white;
    box-shadow: 0 3px 5px rgba(0, 86, 179, 0.2);
}

.calculate-btn::before, .save-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transition: left 0.8s ease;
}

.calculate-btn:hover::before, .save-btn:hover::before {
    left: 100%;
}

.calculate-btn:hover {
    background-color: #e67300;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(255, 127, 0, 0.3);
}

.save-btn:hover {
    background-color: #004494;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 86, 179, 0.3);
}

.calculate-btn:active, .save-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

.calculate-btn:disabled, .save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.calculate-btn i, .save-btn i {
    margin-right: 6px;
    font-size: 14px;
}

/* Message container */
.message-container {
    margin-top: 15px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    display: none;
    align-items: center;
    animation: slideInUp 0.3s ease-out;
}

.message-container i {
    margin-right: 6px;
    font-size: 14px;
}

.message-container.success {
    background-color: #ebf8f2;
    color: #0a6b1d;
    border-left: 3px solid #0a6b1d;
}

.message-container.error {
    background-color: #fef2f2;
    color: #b91c1c;
    border-left: 3px solid #b91c1c;
}

/* Formula Styling */
.formula-block, .formula-description, .formula-example {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 24, 80, 0.05);
}

.asset-depreciation-formula h4 {
    font-size: 16px;
    color: #003b80;
    margin: 0 0 10px 0;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.asset-depreciation-formula h4 i {
    margin-right: 8px;
    color: #0056b3;
}

.formula-equation {
    padding: 15px;
    background-color: #f0f8ff;
    border-radius: 6px;
    border-left: 4px solid #0056b3;
}

.formula-main {
    font-size: 15px;
    font-weight: 600;
    color: #0056b3;
    text-align: center;
}

.formula-description ul {
    margin: 10px 0;
    padding-left: 10px;
    list-style-type: none;
}

.formula-description li {
    margin-bottom: 10px;
    position: relative;
    padding-left: 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3e50;
}

.formula-description li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #0056b3;
    font-weight: bold;
}

.formula-description strong {
    color: #0056b3;
}

.formula-sub {
    margin-top: 5px;
    font-size: 13px;
    color: #4a5568;
    padding-left: 10px;
    border-left: 2px solid #eaeef5;
}

.formula-example {
    background-color: #fffaf0;
    border-left: 4px solid #ff7f00;
}

.example-content {
    font-size: 14px;
    color: #2c3e50;
}

.example-content p {
    margin: 0 0 10px 0;
}

.example-calculation {
    background-color: #fff;
    border-radius: 6px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #000;
    border: 1px solid #ffefd5;
}

.example-calculation div {
    margin-bottom: 5px;
}

.example-calculation div:last-child {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #ffefd5;
    font-weight: bold;
}

/* Animations */
@keyframes slideInUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .asset-depreciation-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    .asset-depreciation-calculator,
    .asset-depreciation-formula {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .asset-depreciation-calculator,
    .asset-depreciation-formula {
        padding: 20px 15px;
        margin: 15px 10px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .calculate-btn, .save-btn {
        width: 100%;
    }
    
    .result-value {
        font-size: 24px;
    }
    
    .result-value .currency {
        font-size: 14px;
    }
    
    .formula-main {
        font-size: 14px;
    }
}