/* 
 * Silkflex Modern Alert System
 * Version: 1.0
 * สำหรับใช้กับ login.html และหน้าอื่นๆ
 */

/* ========================
   ALERT CONTAINER
   ======================== */
.silkflex-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 420px;
    width: calc(100% - 40px);
    z-index: 10000;
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Alert Box */
.silkflex-alert-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: stretch;
    min-height: 80px;
    transform-origin: right center;
}

/* Icon Container */
.silkflex-alert-icon {
    flex-shrink: 0;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Alert Content */
.silkflex-alert-content {
    flex: 1;
    padding: 20px 45px 20px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.silkflex-alert-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 4px 0;
    line-height: 1.3;
    color: #1a202c;
}

.silkflex-alert-message {
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
    color: #4a5568;
}

/* Close Button */
.silkflex-alert-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #718096;
    padding: 0;
    outline: none;
}

.silkflex-alert-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #2d3748;
    transform: rotate(90deg);
}

.silkflex-alert-close:active {
    transform: rotate(90deg) scale(0.9);
}

/* Close Icon SVG */
.silkflex-alert-close svg {
    width: 16px;
    height: 16px;
}

/* Progress Bar */
.silkflex-alert-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    animation: progressBar 5s linear forwards;
    transform-origin: left;
}

/* ========================
   ALERT TYPES
   ======================== */

/* Success */
.silkflex-alert-success .silkflex-alert-icon {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.silkflex-alert-success .silkflex-alert-progress {
    background: #48bb78;
}

/* Error */
.silkflex-alert-error .silkflex-alert-icon {
    background: linear-gradient(135deg, #f56565, #e53e3e);
}

.silkflex-alert-error .silkflex-alert-progress {
    background: #f56565;
}

/* Warning */
.silkflex-alert-warning .silkflex-alert-icon {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}

.silkflex-alert-warning .silkflex-alert-progress {
    background: #ed8936;
}

/* Info */
.silkflex-alert-info .silkflex-alert-icon {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.silkflex-alert-info .silkflex-alert-progress {
    background: #4299e1;
}

/* Icons */
.silkflex-alert-icon svg {
    width: 24px;
    height: 24px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* ========================
   ANIMATIONS
   ======================== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
}

@keyframes progressBar {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* ========================
   MULTIPLE ALERTS STACK
   ======================== */
.silkflex-alert:nth-child(2) {
    top: 120px;
}

.silkflex-alert:nth-child(3) {
    top: 220px;
}

.silkflex-alert:nth-child(4) {
    top: 320px;
}

.silkflex-alert:nth-child(5) {
    top: 420px;
}

/* ========================
   RESPONSIVE DESIGN
   ======================== */
@media (max-width: 480px) {
    .silkflex-alert {
        right: 10px;
        left: 10px;
        max-width: none;
        width: calc(100% - 20px);
    }
    
    .silkflex-alert-content {
        padding: 16px 40px 16px 12px;
    }
    
    .silkflex-alert-title {
        font-size: 15px;
    }
    
    .silkflex-alert-message {
        font-size: 13px;
    }
    
    .silkflex-alert-icon {
        width: 50px;
    }
    
    .silkflex-alert-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* ========================
   DARK MODE SUPPORT
   ======================== */
@media (prefers-color-scheme: dark) {
    .silkflex-alert-box {
        background: #2d3748;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }
    
    .silkflex-alert-title {
        color: #f7fafc;
    }
    
    .silkflex-alert-message {
        color: #cbd5e0;
    }
    
    .silkflex-alert-close {
        color: #a0aec0;
    }
    
    .silkflex-alert-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #e2e8f0;
    }
}

/* ========================
   ACCESSIBILITY
   ======================== */
.silkflex-alert-close:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .silkflex-alert,
    .silkflex-alert-close,
    .silkflex-alert-progress {
        animation: none !important;
        transition: none !important;
    }
}