/* Routines Page Styles - v20251227a */

/* ============================================
   PAGE LAYOUT
   ============================================ */

.routines-page {
    padding: 32px 40px;
    max-width: 1400px;
}

.routines-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.routines-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.routines-title {
    font-size: 30px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.routines-subtitle {
    font-size: 14px;
    color: #4A5565;
    margin: 0;
}

.routines-create-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.routines-create-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ============================================
   SUMMARY CARDS
   ============================================ */

.routines-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.routines-summary-card {
    background: white;
    border: 1px solid #EAECF0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.routines-summary-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.routines-summary-icon--blue {
    background: #EBF5FF;
    color: #155DFC;
}

.routines-summary-icon--green {
    background: #DCFCE7;
    color: #166534;
}

.routines-summary-icon--purple {
    background: #F3E8FF;
    color: #9810FA;
}

.routines-summary-icon--orange {
    background: #FEF3C7;
    color: #92400E;
}

.routines-summary-value {
    font-size: 28px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.routines-summary-label {
    font-size: 14px;
    color: #4A5565;
    margin: 0;
}

/* ============================================
   ROUTINES LIST
   ============================================ */

.routines-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.routine-card {
    background: white;
    border: 1px solid #EAECF0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.routine-card:hover {
    border-color: #155DFC;
    box-shadow: 0 2px 8px rgba(21, 93, 252, 0.1);
}

.routine-card-main {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.routine-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #F3E8FF 0%, #EBF5FF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9810FA;
}

.routine-card-info {
    flex: 1;
}

.routine-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.routine-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

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

.routines-status-badge--active {
    background: #DCFCE7;
    color: #166534;
}

.routines-status-badge--active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22C55E;
    animation: pulseGreen 2s infinite;
}

.routines-status-badge--paused {
    background: #FEF3C7;
    color: #92400E;
}

.routine-card-description {
    font-size: 14px;
    color: #4A5565;
    margin: 0;
}

.routine-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.routine-card-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6B7280;
}

.routine-card-meta-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.routine-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.routine-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #EAECF0;
    border-radius: 8px;
    background: white;
    color: #4A5565;
    cursor: pointer;
    transition: all 0.2s;
}

.routine-action-btn:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.routine-action-btn--danger:hover {
    background: #FEF2F2;
    border-color: #FCA5A5;
    color: #DC2626;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

.routines-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #4A5565;
}

.routines-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #EAECF0;
    border-top-color: #155DFC;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.routines-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.routines-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, #F3E8FF 0%, #EBF5FF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9810FA;
    margin-bottom: 24px;
}

.routines-empty-title {
    font-size: 20px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 8px 0;
}

.routines-empty-text {
    font-size: 14px;
    color: #4A5565;
    margin: 0 0 24px 0;
    max-width: 400px;
}

.routines-empty-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.routines-empty-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ============================================
   MODAL OVERLAY
   ============================================ */

.routines-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

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

.routines-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.routines-modal--wizard {
    width: 600px;
}

.routines-modal--log {
    width: 700px;
}

.routines-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #EAECF0;
}

.routines-modal-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.routines-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.routines-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6B7280;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.routines-modal-close:hover {
    background: #F3F4F6;
    color: #101828;
}

.routines-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #EAECF0;
    background: #F9FAFB;
}

.routines-modal-footer-left {
    display: flex;
    align-items: center;
}

.routines-modal-footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   WIZARD STEPS
   ============================================ */

.routines-wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px;
    background: #F9FAFB;
    gap: 8px;
}

.routines-wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
}

.routines-wizard-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #EAECF0;
    color: #6B7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.routines-wizard-step.active .routines-wizard-step-number {
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
}

.routines-wizard-step.completed .routines-wizard-step-number {
    background: #22C55E;
    color: white;
}

.routines-wizard-step.completed .routines-wizard-step-number::after {
    content: '\2713';
}

.routines-wizard-step-label {
    font-size: 13px;
    color: #6B7280;
    font-weight: 500;
}

.routines-wizard-step.active .routines-wizard-step-label {
    color: #101828;
}

.routines-wizard-step-line {
    width: 24px;
    height: 2px;
    background: #EAECF0;
}

.routines-wizard-step-counter {
    font-size: 13px;
    color: #6B7280;
}

/* ============================================
   WIZARD CONTENT
   ============================================ */

.routines-wizard-content {
    padding: 24px;
    max-height: 400px;
    overflow-y: auto;
}

.routines-wizard-panel {
    animation: fadeIn 0.2s ease-out;
}

.routines-wizard-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #FEF9C3;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #713F12;
}

.routines-wizard-info svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.routines-wizard-examples {
    margin-top: 16px;
}

.routines-wizard-examples-label {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 8px;
}

.routines-example-chip {
    display: inline-block;
    padding: 6px 12px;
    background: #F3F4F6;
    border: 1px solid #EAECF0;
    border-radius: 16px;
    font-size: 13px;
    color: #4A5565;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.routines-example-chip:hover {
    background: #EBF5FF;
    border-color: #155DFC;
    color: #155DFC;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.routines-form-group {
    margin-bottom: 20px;
}

.routines-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #344054;
    margin-bottom: 6px;
}

.routines-form-input,
.routines-form-select,
.routines-form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #D0D5DD;
    border-radius: 8px;
    font-size: 14px;
    color: #101828;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.routines-form-input:focus,
.routines-form-select:focus,
.routines-form-textarea:focus {
    outline: none;
    border-color: #155DFC;
    box-shadow: 0 0 0 3px rgba(21, 93, 252, 0.1);
}

.routines-form-textarea {
    resize: vertical;
    min-height: 100px;
}

.routines-form-hint {
    font-size: 12px;
    color: #6B7280;
    margin-top: 4px;
}

/* ============================================
   ACTION CARDS
   ============================================ */

.routines-action-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.routines-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    background: white;
    border: 2px solid #EAECF0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #4A5565;
}

.routines-action-card:hover {
    border-color: #155DFC;
    background: #F8FAFF;
}

.routines-action-card.active {
    border-color: #155DFC;
    background: #EBF5FF;
    color: #155DFC;
}

.routines-action-card span {
    font-size: 13px;
    font-weight: 500;
}

.routines-action-config {
    animation: fadeIn 0.2s ease-out;
}

.routines-template-vars {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.routines-template-vars-label {
    font-size: 12px;
    color: #6B7280;
}

.routines-template-vars code {
    padding: 2px 6px;
    background: #F3F4F6;
    border-radius: 4px;
    font-size: 12px;
    color: #155DFC;
    font-family: monospace;
}

/* ============================================
   AUDIENCE PREVIEW
   ============================================ */

.routines-audience-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #F0FDF4;
    border-radius: 8px;
    margin-top: 16px;
}

.routines-audience-preview-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #166534;
}

.routines-audience-preview span {
    font-size: 14px;
    color: #166534;
    font-weight: 500;
}

/* ============================================
   PREVIEW & ACTIVATE PANELS
   ============================================ */

.routines-preview-card {
    background: #F9FAFB;
    border: 1px solid #EAECF0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.routines-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 12px 0;
}

.routines-preview-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #EAECF0;
}

.routines-preview-item:last-child {
    border-bottom: none;
}

.routines-preview-label {
    font-size: 14px;
    color: #6B7280;
}

.routines-preview-value {
    font-size: 14px;
    color: #101828;
    font-weight: 500;
}

.routines-preview-customers {
    margin-top: 20px;
}

.routines-preview-customers-title {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 12px 0;
}

.routines-preview-customers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.routines-preview-customer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: white;
    border: 1px solid #EAECF0;
    border-radius: 8px;
}

.routines-preview-customer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.routines-preview-customer-info {
    flex: 1;
}

.routines-preview-customer-name {
    font-size: 14px;
    font-weight: 500;
    color: #101828;
}

.routines-preview-customer-detail {
    font-size: 12px;
    color: #6B7280;
}

/* Activate Panel */

.routines-activate-summary {
    text-align: center;
    padding: 20px 0;
}

.routines-activate-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, #F3E8FF 0%, #EBF5FF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9810FA;
    margin: 0 auto 16px;
}

.routines-activate-title {
    font-size: 20px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 4px 0;
}

.routines-activate-description {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

.routines-activate-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 12px;
    margin: 20px 0;
}

.routines-activate-detail {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #4A5565;
}

.routines-activate-detail svg {
    color: #155DFC;
}

.routines-activate-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: #FEF9C3;
    border-radius: 8px;
    font-size: 13px;
    color: #713F12;
}

.routines-activate-note svg {
    flex-shrink: 0;
    margin-top: 1px;
}

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

.routines-btn-primary {
    padding: 10px 20px;
    background: linear-gradient(90deg, #9810FA 0%, #155DFC 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.routines-btn-primary:hover {
    opacity: 0.9;
}

.routines-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.routines-btn-secondary {
    padding: 10px 20px;
    background: white;
    color: #344054;
    border: 1px solid #D0D5DD;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.routines-btn-secondary:hover {
    background: #F9FAFB;
}

.routines-btn-activate {
    padding: 12px 28px;
    background: #22C55E;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.routines-btn-activate:hover {
    background: #16A34A;
}

/* ============================================
   EXECUTION LOG MODAL
   ============================================ */

.routines-log-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 20px 24px;
    background: #F9FAFB;
}

.routines-log-stat {
    text-align: center;
}

.routines-log-stat-value {
    font-size: 28px;
    font-weight: 600;
    color: #101828;
    margin: 0;
}

.routines-log-stat-label {
    font-size: 13px;
    color: #6B7280;
    margin: 4px 0 0 0;
}

.routines-log-timeline {
    padding: 20px 24px;
    max-height: 350px;
    overflow-y: auto;
}

.routines-log-timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 16px 0;
}

.routines-log-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.routines-log-entry {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #EAECF0;
    border-radius: 10px;
}

.routines-log-entry-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #DCFCE7;
    color: #166534;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.routines-log-entry-icon--failed {
    background: #FEE2E2;
    color: #DC2626;
}

.routines-log-entry-content {
    flex: 1;
}

.routines-log-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.routines-log-entry-title {
    font-size: 14px;
    font-weight: 500;
    color: #101828;
}

.routines-log-entry-time {
    font-size: 12px;
    color: #6B7280;
}

.routines-log-entry-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #4A5565;
}

.routines-log-entry-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.routines-log-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6B7280;
    font-size: 14px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes pulseGreen {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

@media (max-width: 1024px) {
    .routines-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .routines-page {
        padding: 20px;
    }

    .routines-header {
        flex-direction: column;
        gap: 16px;
    }

    .routines-summary-grid {
        grid-template-columns: 1fr;
    }

    .routines-modal--wizard,
    .routines-modal--log {
        width: calc(100% - 32px);
        max-width: 100%;
        margin: 16px;
    }

    .routines-wizard-steps {
        flex-wrap: wrap;
        gap: 4px;
    }

    .routines-wizard-step-label {
        display: none;
    }

    .routines-action-cards {
        grid-template-columns: 1fr;
    }
}
