/* ===== TEMPLATE MODAL STYLES ===== */

/* Template tabs */
.template-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.template-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.template-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.template-tab.active {
    color: var(--primary);
    font-weight: bold;
}

.template-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

/* Template tab content */
.template-tab-content {
    min-height: 300px;
}

/* Template list */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#template-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

.template-item {
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.template-item.selected {
    background: rgba(65, 105, 225, 0.2);
    border-color: var(--primary);
}

.template-item-info {
    flex: 1;
}

.template-item-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.template-item-description {
    font-size: 0.9em;
    color: var(--text-muted);
}

.template-item-actions {
    display: flex;
    gap: 5px;
}

/* Template date selector */
.template-date-selector {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.template-date-selector label {
    font-weight: bold;
}

.template-date-selector input[type="date"] {
    padding: 5px 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
}

/* Template preview */
.template-preview {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 5px;
    max-height: 250px;
    overflow-y: auto;
}

.template-preview h5 {
    margin-bottom: 10px;
    color: var(--primary);
}

.preview-segment {
    padding: 8px;
    margin-bottom: 5px;
    background: var(--bg-dark);
    border-left: 3px solid transparent;
    border-radius: 3px;
    font-size: 0.9em;
}

.preview-segment.daily {
    border-left-color: #ffa500;
}

.preview-segment.recurring {
    border-left-color: #00bcd4;
}

.preview-segment.permanent {
    border-left-color: #4caf50;
}

.preview-segment.block-container {
    border-left-color: #9e9e9e;
    background: rgba(158, 158, 158, 0.1);
    border: 1px dashed rgba(158, 158, 158, 0.5);
}

.preview-segment .segment-type {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    font-size: 0.8em;
    margin-left: 10px;
}

/* Template creator */
.template-creator {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.template-creator label {
    font-weight: bold;
    margin-bottom: 5px;
}

.template-creator input[type="text"],
.template-creator textarea {
    padding: 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-family: inherit;
}

.template-creator textarea {
    min-height: 80px;
    resize: vertical;
}

.template-from-conductor {
    margin-top: 20px;
    padding: 15px;
    background: rgba(65, 105, 225, 0.1);
    border: 1px solid rgba(65, 105, 225, 0.3);
    border-radius: 5px;
    text-align: center;
}

.template-from-conductor .hint {
    margin-top: 10px;
    font-size: 0.9em;
    color: var(--text-muted);
}

/* Template manager */
.template-manager {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#template-manage-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.template-manage-item {
    padding: 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-manage-item:hover {
    background: var(--bg-hover);
}

.template-manage-info {
    flex: 1;
}

.template-manage-actions {
    display: flex;
    gap: 10px;
}

.template-manage-actions button {
    padding: 5px 10px;
    font-size: 0.9em;
}

/* Daily status */
.daily-status {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 5px;
}

.daily-status h4 {
    margin-bottom: 15px;
    color: var(--primary);
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.status-label {
    font-size: 0.9em;
    color: var(--text-muted);
}

.status-value {
    font-weight: bold;
    font-size: 1.1em;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.3s ease;
}

#status-missing {
    color: #ffa500;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Button styles */
.btn-template {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-template:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-template.danger {
    background: var(--danger);
}

.btn-template.danger:hover {
    background: var(--danger-hover);
}

/* Responsive */
@media (max-width: 768px) {
    .status-grid {
        grid-template-columns: 1fr;
    }
    
    .template-tabs {
        flex-direction: column;
    }
    
    .template-tab {
        width: 100%;
        text-align: left;
    }
}