/**
 * Template Modals - Exact TradingView Style
 * Extracted from TradingView production UI
 */

.template-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.template-modal {
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 450px;
    position: relative;
    animation: slideIn 0.15s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
}

@keyframes slideIn {
    from {
        transform: translateY(-8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .template-modal {
        background: #1e222d;
        color: #d1d4dc;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    }
}

.template-modal-header {
    padding: 16px 48px 8px 16px;
    position: relative;
}

.template-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #131722;
    transition: opacity 0.1s;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.template-modal-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    .template-modal-close {
        color: #d1d4dc;
    }
    
    .template-modal-close:hover {
        background: rgba(255, 255, 255, 0.05);
    }
}

.template-modal-close svg {
    display: block;
    width: 18px;
    height: 18px;
}

.template-modal-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: #131722;
    line-height: 22px;
    letter-spacing: -0.01em;
}

@media (prefers-color-scheme: dark) {
    .template-modal-title {
        color: #d1d4dc;
    }
}

.template-modal-body {
    padding: 8px 16px 16px 16px;
}

.template-modal-label {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #6a6d78;
    margin-bottom: 6px;
    text-transform: none;
    letter-spacing: 0;
}

@media (prefers-color-scheme: dark) {
    .template-modal-label {
        color: #868993;
    }
}

.template-modal-input-wrapper {
    position: relative;
}

.template-modal-input {
    width: 100%;
    padding: 7px 32px 7px 7px;
    border: 1px solid #2962ff;
    border-radius: 2px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
    color: #131722;
    background: #ffffff;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
    line-height: 18px;
    height: 34px;
}

.template-modal-input:focus {
    outline: none;
    border-color: #2962ff;
}

.template-modal-input::placeholder {
    color: #b2b5be;
}

@media (prefers-color-scheme: dark) {
    .template-modal-input {
        background: #2a2e39;
        border-color: #2962ff;
        color: #d1d4dc;
    }
    
    .template-modal-input:focus {
        border-color: #2962ff;
    }
    
    .template-modal-input::placeholder {
        color: #6a6d78;
    }
}

.template-modal-input-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #131722;
    pointer-events: none;
    width: 18px;
    height: 18px;
}

@media (prefers-color-scheme: dark) {
    .template-modal-input-icon {
        color: #868993;
    }
}

.template-modal-message {
    font-size: 13px;
    line-height: 18px;
    color: #131722;
    margin: 0;
}

@media (prefers-color-scheme: dark) {
    .template-modal-message {
        color: #d1d4dc;
    }
}

.template-modal-name {
    font-weight: 600;
    color: #131722;
}

@media (prefers-color-scheme: dark) {
    .template-modal-name {
        color: #d1d4dc;
    }
}

.template-modal-footer {
    padding: 0 16px 16px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.template-modal-button {
    padding: 5px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background-color 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
    height: 30px;
    line-height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.template-modal-button-cancel {
    background: transparent;
    color: #131722;
}

.template-modal-button-cancel:hover {
    background: rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
    .template-modal-button-cancel {
        color: #d1d4dc;
    }
    .template-modal-button-cancel:hover {
        background: rgba(255, 255, 255, 0.06);
    }
}

.template-modal-button-delete {
    background: #f23645;
    color: #ffffff;
}

.template-modal-button-delete:hover {
    background: #d63140;
}

.template-modal-button-delete:active {
    background: #c42d3a;
}

.template-modal-button-save {
    background: #e0e3eb;
    color: #9598a1;
}

.template-modal-button-save:not(:disabled) {
    background: #2962ff;
    color: #ffffff;
}

.template-modal-button-save:hover:not(:disabled) {
    background: #1e53e5;
}

.template-modal-button-save:active:not(:disabled) {
    background: #1948cc;
}

.template-modal-button-save:disabled {
    cursor: default;
    opacity: 1;
}

@media (prefers-color-scheme: dark) {
    .template-modal-button-save {
        background: #363a45;
        color: #5d606b;
    }
    
    .template-modal-button-save:not(:disabled) {
        background: #2962ff;
        color: #ffffff;
    }
}
