/**
 * Sian Core Frontend Styles
 * Modal, Toast, Search Results, Download Button
 */

/* ========================================
   Modal
   ======================================== */
.sian-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.sian-modal.active {
    opacity: 1;
    visibility: visible;
}
.sian-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}
.sian-modal-content {
    position: relative;
    width: 440px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}
.sian-modal.active .sian-modal-content {
    transform: translateY(0);
}
.sian-modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.sian-modal-close:hover { color: #333; }

.sian-modal-content h3 {
    font-size: 22px;
    margin-bottom: 8px;
    color: #1a1a1a;
}
.sian-form-desc {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Tabs */
.sian-modal-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.sian-modal-tab {
    cursor: pointer;
    color: #999;
    font-size: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.sian-modal-tab.active {
    color: #1a56db;
    border-bottom-color: #1a56db;
}

/* Form */
.sian-form-group {
    margin-bottom: 16px;
}
.sian-form-group input {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.sian-form-group input:focus {
    border-color: #1a56db;
    outline: none;
}
.sian-form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.sian-form-row input {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.sian-code-row {
    display: flex;
    gap: 12px;
}
.sian-code-row input {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.sian-send-sms {
    white-space: nowrap;
    padding: 0 16px;
    height: 44px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #1a56db;
    transition: all 0.2s;
}
.sian-send-sms:hover { background: #eee; }
.sian-send-sms:disabled { color: #999; cursor: not-allowed; }

.sian-submit-btn {
    width: 100%;
    height: 48px;
    background: #1a56db;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.sian-submit-btn:hover { background: #1545b0; }
.sian-submit-btn:disabled { background: #ccc; cursor: not-allowed; }

.sian-form-footer {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-top: 12px;
}
.sian-form-footer a { color: #1a56db; text-decoration: none; }

.sian-form-msg {
    margin-top: 12px;
    font-size: 13px;
    text-align: center;
    display: none;
}
.sian-msg-error { color: #d63638; display: block; }
.sian-msg-success { color: #2e7d32; display: block; }

/* ========================================
   Download Button
   ======================================== */
.sian-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #1a56db;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.sian-download-btn:hover { background: #1545b0; transform: translateY(-1px); }
.sian-download-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; }
.sian-btn-pending { background: #f59e0b; }
.sian-btn-pending:hover { background: #d97706; }

/* ========================================
   Live Search Results
   ======================================== */
.sian-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
}
.sian-search-results ul {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}
.sian-search-results li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}
.sian-search-results li a:hover { background: #f5f7fa; }
.sian-sr-type {
    font-size: 12px;
    padding: 2px 8px;
    background: #e8f0fe;
    color: #1a56db;
    border-radius: 3px;
    white-space: nowrap;
}
.sian-sr-title { font-size: 14px; }
.sian-sr-more a {
    justify-content: center;
    color: #1a56db;
    font-size: 13px;
    border-top: 1px solid #f0f0f0;
}
.sian-search-results .no-result {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Search highlight */
mark.sian-search-highlight {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

/* ========================================
   Toast Notification
   ======================================== */
.sian-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    z-index: 100000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.sian-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sian-toast-error { background: #d63638; }
.sian-toast-success { background: #2e7d32; }

/* ========================================
   User Area
   ======================================== */
.sian-user-area {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}
.sian-user-area a {
    color: #1a56db;
    text-decoration: none;
}
.sian-user-name {
    color: #333;
    font-weight: 500;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
    .sian-modal-content {
        padding: 24px 20px;
        margin: 10vh auto;
        border-radius: 8px;
    }
    .sian-form-row {
        flex-direction: column;
        gap: 16px;
    }
}
