/* TB Security - Shared Styles
 * This file contains CSS variables and shared UI components
 * used across all pages.
 */

/* =====================================================
   CSS VARIABLES - Color System
   ===================================================== */
:root {
    /* Gray Scale */
    --dl-color-gray-25: rgba(249, 249, 249, 1);
    --dl-color-gray-50: rgba(247, 247, 247, 1);
    --dl-color-gray-100: rgba(242, 243, 245, 1);
    --dl-color-gray-200: rgba(228, 230, 233, 1);
    --dl-color-gray-300: rgba(206, 207, 210, 1);
    --dl-color-gray-400: rgba(148, 150, 156, 1);
    --dl-color-gray-500: rgba(133, 136, 142, 1);
    --dl-color-gray-600: rgba(97, 100, 108, 1);
    --dl-color-gray-700: rgba(55, 58, 65, 1);
    --dl-color-gray-800: rgba(34, 38, 47, 1);
    --dl-color-gray-900: rgba(18, 21, 27, 1);
    --dl-color-gray-950: rgba(12, 14, 18, 1);

    /* Brand (Lime Green) */
    --dl-color-brand-500: rgba(206, 255, 10, 1);
    --dl-color-brand-600: rgba(175, 218, 2, 1);
    --dl-color-brand-700: rgba(138, 171, 0, 1);
    --dl-color-brand-950: rgba(31, 39, 1, 1);

    /* Primary (aliases for brand, used in asset.py & company.py) */
    --dl-color-primary-500: #CEFF0A;
    --dl-color-primary-400: #AFDA02;

    /* Error (Red) */
    --dl-color-error-400: rgba(249, 112, 102, 1);
    --dl-color-error-500: rgba(240, 68, 55, 1);
    --dl-color-error-600: rgba(217, 44, 32, 1);
    --dl-color-error-900: rgba(122, 38, 25, 1);

    /* Success (Green) */
    --dl-color-success-500: rgba(23, 177, 105, 1);
    --dl-color-success-600: rgba(7, 148, 85, 1);
    --dl-color-success-900: rgba(7, 76, 48, 1);

    /* Warning (Orange) */
    --dl-color-warning-500: rgba(247, 143, 8, 1);
    --dl-color-warning-600: rgba(219, 104, 3, 1);
    --dl-color-warning-900: rgba(121, 45, 13, 1);
}

/* =====================================================
   LOADING SPINNER
   ===================================================== */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--dl-color-gray-500);
    font-size: 14px;
    gap: 12px;
}

.loading-spinner::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--dl-color-gray-700);
    border-top-color: var(--dl-color-brand-500);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

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

/* Small spinner variant */
.loading-spinner-sm {
    padding: 20px 10px;
    font-size: 12px;
    gap: 8px;
}

.loading-spinner-sm::before {
    width: 14px;
    height: 14px;
}

/* Inline spinner (no padding) */
.loading-spinner-inline {
    display: inline-flex;
    padding: 0;
    gap: 6px;
}

.loading-spinner-inline::before {
    width: 12px;
    height: 12px;
}

/* =====================================================
   STAR LOADER - Corporate TB Security Loading Animation
   ===================================================== */
@keyframes starPulse {
    0%, 100% { opacity: 0.2; fill: #555; }
    50% { opacity: 1; fill: #CEFF0A; }
}

.star-loader {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}

.star-loader svg {
    width: 16px;
    height: 16px;
}

.star-loader svg:nth-child(1) path { animation: starPulse 1.2s ease-in-out infinite; animation-delay: 0s; }
.star-loader svg:nth-child(2) path { animation: starPulse 1.2s ease-in-out infinite; animation-delay: 0.2s; }
.star-loader svg:nth-child(3) path { animation: starPulse 1.2s ease-in-out infinite; animation-delay: 0.4s; }

/* Larger star loader variant */
.star-loader-lg {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.star-loader-lg svg {
    width: 24px;
    height: 24px;
}

.star-loader-lg svg:nth-child(1) path { animation: starPulse 1.2s ease-in-out infinite; animation-delay: 0s; }
.star-loader-lg svg:nth-child(2) path { animation: starPulse 1.2s ease-in-out infinite; animation-delay: 0.2s; }
.star-loader-lg svg:nth-child(3) path { animation: starPulse 1.2s ease-in-out infinite; animation-delay: 0.4s; }

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--dl-color-gray-500);
    text-align: center;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--dl-color-gray-400);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    color: var(--dl-color-gray-500);
    max-width: 300px;
}

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: toast-slide-in 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.toast.toast-success {
    background: var(--dl-color-success-900);
    color: var(--dl-color-success-500);
    border: 1px solid var(--dl-color-success-500);
}

.toast.toast-error {
    background: var(--dl-color-error-900);
    color: var(--dl-color-error-400);
    border: 1px solid var(--dl-color-error-500);
}

.toast.toast-warning {
    background: var(--dl-color-warning-900);
    color: var(--dl-color-warning-500);
    border: 1px solid var(--dl-color-warning-500);
}

.toast.toast-info {
    background: var(--dl-color-gray-800);
    color: var(--dl-color-gray-300);
    border: 1px solid var(--dl-color-gray-700);
}

.toast.toast-hide {
    animation: toast-slide-out 0.3s ease forwards;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* =====================================================
   TB MODAL SYSTEM - Alert, Confirm, Prompt
   ===================================================== */

/* Modal Container */
#tb-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#tb-modal-container.show {
    display: flex;
    opacity: 1;
}

/* Modal Box */
.tb-modal {
    background: var(--dl-color-gray-900);
    border: 1px solid var(--dl-color-gray-700);
    border-radius: 16px;
    padding: 0;
    width: 420px;
    max-width: 90%;
    animation: tb-modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

@keyframes tb-modal-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header with Icon */
.tb-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px 0;
}

.tb-modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tb-modal-icon svg {
    width: 24px;
    height: 24px;
}

/* Icon variants */
.tb-modal-icon.icon-success {
    background: rgba(23, 177, 105, 0.15);
}
.tb-modal-icon.icon-success svg {
    color: var(--dl-color-success-500);
}

.tb-modal-icon.icon-error {
    background: rgba(240, 68, 55, 0.15);
}
.tb-modal-icon.icon-error svg {
    color: var(--dl-color-error-500);
}

.tb-modal-icon.icon-warning {
    background: rgba(247, 143, 8, 0.15);
}
.tb-modal-icon.icon-warning svg {
    color: var(--dl-color-warning-500);
}

.tb-modal-icon.icon-info {
    background: rgba(206, 255, 10, 0.1);
}
.tb-modal-icon.icon-info svg {
    color: var(--dl-color-brand-500);
}

.tb-modal-icon.icon-question {
    background: rgba(133, 136, 142, 0.15);
}
.tb-modal-icon.icon-question svg {
    color: var(--dl-color-gray-400);
}

.tb-modal-icon.icon-input {
    background: rgba(206, 255, 10, 0.1);
}
.tb-modal-icon.icon-input svg {
    color: var(--dl-color-brand-500);
}

/* Modal Title */
.tb-modal-title {
    font-family: 'Geologica', 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--dl-color-gray-100);
    margin: 0;
    line-height: 1.3;
}

/* Modal Body */
.tb-modal-body {
    padding: 16px 24px 24px;
}

.tb-modal-message {
    font-size: 14px;
    color: var(--dl-color-gray-400);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Input field for prompt */
.tb-modal-input {
    width: 100%;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--dl-color-gray-800);
    border: 1px solid var(--dl-color-gray-700);
    border-radius: 10px;
    color: var(--dl-color-gray-100);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.tb-modal-input:focus {
    border-color: var(--dl-color-brand-500);
    box-shadow: 0 0 0 3px rgba(206, 255, 10, 0.1);
}

.tb-modal-input::placeholder {
    color: var(--dl-color-gray-600);
}

/* Modal Actions */
.tb-modal-actions {
    display: flex;
    gap: 10px;
    padding: 0 24px 24px;
    justify-content: flex-end;
}

.tb-modal-btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-family: 'Geologica', 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 90px;
    justify-content: center;
}

.tb-modal-btn:focus {
    outline: none;
}

.tb-modal-btn:focus-visible {
    outline: 2px solid var(--dl-color-brand-500);
    outline-offset: 2px;
}

/* Cancel button */
.tb-modal-btn-cancel {
    background: var(--dl-color-gray-800);
    color: var(--dl-color-gray-300);
    border: 1px solid var(--dl-color-gray-700);
}

.tb-modal-btn-cancel:hover {
    background: var(--dl-color-gray-700);
    border-color: var(--dl-color-gray-600);
}

/* Primary button (green/brand) */
.tb-modal-btn-primary {
    background: var(--dl-color-brand-500);
    color: var(--dl-color-gray-950);
}

.tb-modal-btn-primary:hover {
    background: var(--dl-color-brand-600);
}

/* Danger button (red) */
.tb-modal-btn-danger {
    background: var(--dl-color-error-500);
    color: white;
}

.tb-modal-btn-danger:hover {
    background: var(--dl-color-error-600);
}

/* Success button */
.tb-modal-btn-success {
    background: var(--dl-color-success-500);
    color: white;
}

.tb-modal-btn-success:hover {
    background: var(--dl-color-success-600);
}

/* Legacy confirm modal support */
.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.confirm-modal.show {
    display: flex;
}

.confirm-modal-content {
    background: var(--dl-color-gray-900);
    border: 1px solid var(--dl-color-gray-800);
    border-radius: 12px;
    padding: 24px;
    width: 400px;
    max-width: 90%;
    animation: tb-modal-in 0.2s ease;
}

.confirm-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dl-color-gray-200);
    margin-bottom: 12px;
}

.confirm-modal-message {
    font-size: 14px;
    color: var(--dl-color-gray-400);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-modal-btn-cancel {
    background: var(--dl-color-gray-800);
    color: var(--dl-color-gray-300);
}

.confirm-modal-btn-cancel:hover {
    background: var(--dl-color-gray-700);
}

.confirm-modal-btn-confirm {
    background: var(--dl-color-error-500);
    color: white;
}

.confirm-modal-btn-confirm:hover {
    background: var(--dl-color-error-600);
}

.confirm-modal-btn-confirm.btn-primary {
    background: var(--dl-color-brand-500);
    color: var(--dl-color-gray-950);
}

.confirm-modal-btn-confirm.btn-primary:hover {
    background: var(--dl-color-brand-600);
}

/* =====================================================
   ERROR MESSAGE
   ===================================================== */
.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--dl-color-error-900);
    border: 1px solid var(--dl-color-error-500);
    border-radius: 8px;
    color: var(--dl-color-error-400);
    font-size: 14px;
}

.error-message-icon {
    flex-shrink: 0;
}

/* =====================================================
   ACCESSIBILITY - Screen Reader Only
   ===================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =====================================================
   FOCUS VISIBLE - Keyboard Navigation
   ===================================================== */
*:focus-visible {
    outline: 2px solid var(--dl-color-brand-500);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--dl-color-brand-500);
    outline-offset: 2px;
}

/* =====================================================
   LANGUAGE SELECTOR - i18n Support (kept for future use)
   ===================================================== */
.language-selector {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--dl-color-gray-800);
    border-radius: 8px;
    border: 1px solid var(--dl-color-gray-700);
}

.lang-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--dl-color-gray-500);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lang-btn:hover {
    color: var(--dl-color-gray-300);
    background: var(--dl-color-gray-700);
}

.lang-btn.active {
    background: var(--dl-color-brand-500);
    color: var(--dl-color-gray-950);
}

.lang-btn.active:hover {
    background: var(--dl-color-brand-600);
}
