/**
 * Tutorial Builder CSS
 */

/* ============================================
   VARIABLES & RESET
   ============================================ */
:root {
    --tb-primary: #2271b1;
    --tb-primary-hover: #135e96;
    --tb-secondary: #f0f0f1;
    --tb-secondary-hover: #e0e0e1;
    --tb-danger: #d63638;
    --tb-danger-hover: #b32d2e;
    --tb-success: #00a32a;
    --tb-text: #1d2327;
    --tb-text-light: #646970;
    --tb-border: #c3c4c7;
    --tb-bg: #ffffff;
    --tb-bg-light: #f6f7f7;
}

.tb-editor-wrapper *,
.tb-single-tutorial *,
.tb-tutorial-list *,
.tb-my-tutorials * {
    box-sizing: border-box;
}

/* ============================================
   BUTTONS
   ============================================ */
.tb-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.tb-btn-primary {
    background: var(--tb-primary);
    color: white;
}

.tb-btn-primary:hover {
    background: var(--tb-primary-hover);
    color: white;
}

.tb-btn-secondary {
    background: var(--tb-secondary);
    color: var(--tb-text);
    border: 1px solid var(--tb-border);
}

.tb-btn-secondary:hover {
    background: var(--tb-secondary-hover);
    color: var(--tb-text);
}

.tb-btn-danger {
    background: var(--tb-danger);
    color: white;
}

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

.tb-btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.tb-btn-icon {
    padding: 6px 10px;
    font-size: 14px;
    background: transparent;
    border: 1px solid var(--tb-border);
    border-radius: 3px;
    cursor: pointer;
    color: var(--tb-text);
}

.tb-btn-icon:hover {
    background: var(--tb-secondary);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.tb-input,
.tb-textarea,
.tb-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--tb-border);
    border-radius: 4px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.tb-input:focus,
.tb-textarea:focus,
.tb-select:focus {
    outline: none;
    border-color: var(--tb-primary);
    box-shadow: 0 0 0 1px var(--tb-primary);
}

.tb-textarea {
    resize: vertical;
}

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

.tb-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--tb-text);
    font-size: 14px;
}

.tb-help-text {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--tb-text-light);
}

/* ============================================
   EDITOR LAYOUT
   ============================================ */
.tb-editor-wrapper {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.tb-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--tb-secondary);
}

.tb-editor-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--tb-text);
    margin: 0;
}

.tb-header-actions {
    display: flex;
    gap: 10px;
}

.tb-editor-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tb-form-section {
    margin-bottom: 30px;
}

/* ============================================
   INFO BOX
   ============================================ */
.tb-info-box {
    background: #f0f6fc;
    border-left: 4px solid var(--tb-primary);
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.tb-info-box h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: var(--tb-text);
}

.tb-info-box p {
    margin: 0;
    font-size: 14px;
    color: var(--tb-text-light);
    line-height: 1.6;
}

/* ============================================
   STEPS SECTION
   ============================================ */
.tb-steps-section {
    margin: 30px 0;
}

.tb-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tb-section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--tb-text);
    margin: 0;
}

.tb-steps-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tb-add-step-footer {
    margin-top: 20px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid var(--tb-border);
}

.tb-step-item {
    background: var(--tb-bg-light);
    border: 1px solid var(--tb-border);
    border-radius: 6px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.tb-step-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tb-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--tb-border);
}

.tb-step-number {
    background: var(--tb-primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.tb-step-actions {
    display: flex;
    gap: 6px;
}

.tb-step-content {
    background: white;
    padding: 20px;
    border-radius: 4px;
}

/* ============================================
   IMAGE UPLOAD
   ============================================ */
.tb-image-upload {
    position: relative;
    border: 2px dashed var(--tb-border);
    border-radius: 6px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
}

.tb-image-upload:hover {
    border-color: var(--tb-primary);
    background: #f0f6fc;
}

.tb-upload-placeholder {
    padding: 40px;
    text-align: center;
}

.tb-upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.tb-upload-text {
    color: var(--tb-text-light);
    font-size: 14px;
}

.tb-upload-text strong {
    color: var(--tb-text);
    display: block;
    margin-bottom: 4px;
}

.tb-image-upload[data-has-image="true"] .tb-upload-placeholder {
    display: none;
}

.tb-image-preview {
    position: relative;
    display: none;
}

.tb-image-upload[data-has-image="true"] .tb-image-preview {
    display: block;
}

.tb-image-preview img {
    width: 100%;
    display: block;
    border-radius: 4px;
}

.tb-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--tb-danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.tb-remove-image:hover {
    transform: scale(1.1);
}

/* ============================================
   EDITOR FOOTER
   ============================================ */
.tb-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--tb-secondary);
}

.tb-footer-right {
    display: flex;
    gap: 10px;
}

/* ============================================
   NOTIFICATION
   ============================================ */
.tb-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    max-width: 350px;
    padding: 16px 20px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.tb-notification.show {
    transform: translateX(0);
}

.tb-notification.success {
    border-left: 4px solid var(--tb-success);
}

.tb-notification.error {
    border-left: 4px solid var(--tb-danger);
}

/* ============================================
   SINGLE TUTORIAL
   ============================================ */
.tb-single-tutorial {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.tb-tutorial-container {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tb-tutorial-header {
    margin-bottom: 30px;
}

.tb-tutorial-title {
    font-size: 36px;
    font-weight: 600;
    color: var(--tb-text);
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.tb-tutorial-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: var(--tb-text-light);
    padding-bottom: 20px;
    border-bottom: 2px solid var(--tb-secondary);
}

.tb-category-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--tb-secondary);
    border-radius: 4px;
    font-size: 13px;
    color: var(--tb-text);
    font-weight: 500;
}

.tb-meta-separator {
    margin: 0 4px;
}

.tb-progress-section {
    margin: 20px 0;
}

.tb-step-indicator {
    font-size: 14px;
    font-weight: 600;
    color: var(--tb-text);
    margin-bottom: 8px;
    text-align: center;
}

.tb-progress-bar {
    background: var(--tb-secondary);
    height: 8px;
    border-radius: 4px;
    margin: 30px 0;
    overflow: hidden;
}

.tb-progress-fill {
    background: var(--tb-primary);
    height: 100%;
    width: 0;
    transition: width 0.3s ease;
}

.tb-tutorial-intro {
    margin: 30px 0;
    padding: 20px;
    background: var(--tb-bg-light);
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--tb-text-light);
}

.tb-tutorial-steps {
    margin: 30px 0;
}

.tb-tutorial-step {
    margin-bottom: 50px;
}

.tb-step-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.tb-step-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--tb-text);
    margin: 0;
}

.tb-step-image {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--tb-border);
}

.tb-step-image img {
    width: 100%;
    display: block;
}

.tb-video-upload {
    position: relative;
    border: 2px dashed var(--tb-border);
    border-radius: 6px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-video-upload:hover {
    border-color: var(--tb-primary);
    background: #f0f6fc;
}

.tb-video-upload .tb-upload-placeholder {
    padding: 40px;
    text-align: center;
    width: 100%;
}

.tb-video-upload[data-has-video="true"] .tb-upload-placeholder {
    display: none;
}

.tb-video-preview {
    position: relative;
    display: none;
}

.tb-video-upload[data-has-video="true"] .tb-video-preview {
    display: block;
}

.tb-video-preview video {
    width: 100%;
    display: block;
    border-radius: 4px;
}

.tb-video-preview .tb-remove-video {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.tb-video-preview .tb-remove-video:hover {
    background: rgba(0, 0, 0, 0.9);
}

.tb-step-video {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--tb-border);
}

.tb-step-video video {
    width: 100%;
    display: block;
}

.tb-step-description {
    font-size: 16px;
    line-height: 1.8;
    color: var(--tb-text);
}

.tb-navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin: 40px 0;
    padding-top: 30px;
    border-top: 2px solid var(--tb-secondary);
}

.tb-tutorial-footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid var(--tb-secondary);
}

.tb-help-box {
    background: var(--tb-bg-light);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

.tb-help-box h3 {
    font-size: 20px;
    margin: 0 0 12px 0;
    color: var(--tb-text);
}

.tb-help-box p {
    font-size: 15px;
    color: var(--tb-text-light);
    margin: 0 0 20px 0;
    line-height: 1.6;
}

/* ============================================
   TUTORIAL LIST
   ============================================ */
.tb-tutorial-list {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.tb-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tb-list-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--tb-text);
    margin: 0;
}

.tb-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--tb-bg-light);
    border-radius: 8px;
}

.tb-filter-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--tb-border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--tb-text);
    transition: all 0.2s;
}

.tb-filter-btn:hover {
    background: var(--tb-primary);
    color: white;
    border-color: var(--tb-primary);
}

.tb-filter-btn.active {
    background: var(--tb-primary);
    color: white;
    border-color: var(--tb-primary);
}

.tb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.tb-tutorial-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tb-tutorial-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.tb-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--tb-bg-light);
}

.tb-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tb-card-content {
    padding: 20px;
}

.tb-card-category {
    font-size: 12px;
    font-weight: 600;
    color: var(--tb-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.tb-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.tb-card-title a {
    color: var(--tb-text);
    text-decoration: none;
}

.tb-card-title a:hover {
    color: var(--tb-primary);
}

.tb-card-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--tb-text-light);
    margin-bottom: 15px;
}

.tb-card-link {
    color: var(--tb-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.tb-card-link:hover {
    text-decoration: underline;
}

/* ============================================
   MY TUTORIALS
   ============================================ */
.tb-my-tutorials {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.tb-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tb-page-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--tb-text);
    margin: 0;
}

.tb-tutorials-table {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.tb-table {
    width: 100%;
    border-collapse: collapse;
}

.tb-table th {
    background: var(--tb-bg-light);
    padding: 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--tb-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tb-table td {
    padding: 15px;
    border-top: 1px solid var(--tb-secondary);
    font-size: 14px;
}

.tb-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tb-status-published {
    background: #e7f7ed;
    color: var(--tb-success);
}

.tb-status-draft {
    background: #fff3cd;
    color: #856404;
}

.tb-action-buttons {
    display: flex;
    gap: 6px;
}

.tb-text-muted {
    color: var(--tb-text-light);
}

.tb-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tb-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.tb-empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--tb-text);
    margin: 0 0 12px 0;
}

.tb-empty-state p {
    font-size: 16px;
    color: var(--tb-text-light);
    margin: 0 0 24px 0;
}

/* ============================================
   NOTICES
   ============================================ */
.tb-notice {
    padding: 16px 20px;
    border-radius: 6px;
    margin: 20px 0;
    font-size: 14px;
}

.tb-notice-error {
    background: #fef2f2;
    border-left: 4px solid var(--tb-danger);
    color: #991b1b;
}

.tb-notice-info {
    background: #f0f6fc;
    border-left: 4px solid var(--tb-primary);
    color: #1e40af;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .tb-editor-header,
    .tb-list-header,
    .tb-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .tb-header-actions,
    .tb-footer-right {
        width: 100%;
    }
    
    .tb-header-actions .tb-btn,
    .tb-footer-right .tb-btn {
        flex: 1;
    }
    
    .tb-grid {
        grid-template-columns: 1fr;
    }
    
    .tb-tutorial-container {
        padding: 20px;
    }
    
    .tb-tutorial-title {
        font-size: 28px;
    }
    
    .tb-step-title {
        font-size: 20px;
    }
    
    .tb-table {
        font-size: 12px;
    }
    
    .tb-table th,
    .tb-table td {
        padding: 10px;
    }
    
    .tb-editor-footer {
        flex-direction: column;
        gap: 15px;
    }
    
    .tb-footer-left,
    .tb-footer-right {
        width: 100%;
    }
}
