/**
 * RG Document Update System - Styles
 * Version: 2.0.0
 * Date: 2025-01-10
 */

/* ========================================
   NOTIFICATION SYSTEM
   ======================================== */

.rg-notification {
    position: fixed;
    top: 20px;
    right: -400px;
    min-width: 320px;
    max-width: 400px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.rg-notification.show {
    right: 20px;
}

.rg-notification.hiding {
    opacity: 0;
    transform: translateX(20px);
}

/* Notification Types */
.rg-notification.success {
    border-left: 4px solid #28a745;
    background: #d4edda;
    color: #155724;
}

.rg-notification.error {
    border-left: 4px solid #dc3545;
    background: #f8d7da;
    color: #721c24;
}

.rg-notification.warning {
    border-left: 4px solid #ffc107;
    background: #fff3cd;
    color: #856404;
}

.rg-notification.info {
    border-left: 4px solid #17a2b8;
    background: #d1ecf1;
    color: #0c5460;
}

/* Notification Content */
.rg-notification-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.rg-notification-icon {
    flex-shrink: 0;
    font-size: 20px;
    margin-top: 2px;
}

.rg-notification.success .rg-notification-icon::before {
    content: '\2713';
}

.rg-notification.error .rg-notification-icon::before {
    content: '\2715';
}

.rg-notification.warning .rg-notification-icon::before {
    content: '\26A0';
}

.rg-notification.info .rg-notification-icon::before {
    content: '\2139';
}

.rg-notification-message {
    flex: 1;
    word-wrap: break-word;
}

.rg-notification-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    transition: opacity 0.2s;
}

.rg-notification-close:hover {
    opacity: 1;
}

/* ========================================
   TABLE ROW ANIMATIONS
   ======================================== */

.row-updated {
    animation: rowHighlight 2s ease-in-out;
}

@keyframes rowHighlight {
    0% {
        background-color: #fff3cd;
    }
    50% {
        background-color: #fffaed;
    }
    100% {
        background-color: transparent;
    }
}

.row-saving {
    opacity: 0.6;
    pointer-events: none;
}

/* ========================================
   DOCUMENT INPUTS
   ======================================== */

.doc-number-input,
.doc-amount-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.doc-number-input:focus,
.doc-amount-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.doc-number-input.error,
.doc-amount-input.error {
    border-color: #dc3545;
}

.doc-number-input.success,
.doc-amount-input.success {
    border-color: #28a745;
}

/* ========================================
   BUTTONS
   ======================================== */

.save-document-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.save-document-row:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.save-document-row:active:not(:disabled) {
    transform: translateY(0);
}

.save-document-row:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.save-document-row.loading {
    position: relative;
    color: transparent;
}

.save-document-row.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: btnSpinner 0.6s linear infinite;
}

@keyframes btnSpinner {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   PRINT STATUS INDICATORS
   ======================================== */

.print-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.print-status.printed {
    background: #d4edda;
    color: #155724;
}

.print-status.not-printed {
    background: #f8d7da;
    color: #721c24;
}

.print-status.printing {
    background: #fff3cd;
    color: #856404;
}

/* ========================================
   PRINT BUTTON IN TABLE (Management Column)
   ======================================== */

.k-btn-print {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 5px;
}

.k-btn-print:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.k-btn-print:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(40, 167, 69, 0.2);
}

.k-btn-print:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.k-btn-print i {
    font-size: 12px;
}

/* ========================================
   DOCUMENT TYPE SELECTOR
   ======================================== */

.document-type-selector {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.document-type-selector:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.document-type-selector:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

.rg-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.rg-loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.rg-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .rg-notification {
        left: 10px;
        right: 10px;
        min-width: auto;
        max-width: none;
    }

    .rg-notification.show {
        right: 10px;
    }

    .save-document-row {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
.save-document-row:focus-visible,
.doc-number-input:focus-visible,
.doc-amount-input:focus-visible,
.document-type-selector:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.rg-hidden {
    display: none !important;
}

.rg-visible {
    display: block !important;
}

.rg-text-success {
    color: #28a745 !important;
}

.rg-text-error {
    color: #dc3545 !important;
}

.rg-text-warning {
    color: #ffc107 !important;
}

.rg-text-info {
    color: #17a2b8 !important;
}
