/* KingzDesigns CodeShare - Frontend Styles */

:root {
    --kzcs-primary: #667eea;
    --kzcs-primary-dark: #764ba2;
    --kzcs-secondary: #4facfe;
    --kzcs-success: #10b981;
    --kzcs-error: #ef4444;
    --kzcs-warning: #f59e0b;
    --kzcs-dark: #1e293b;
    --kzcs-darker: #0f172a;
    --kzcs-gray: #64748b;
    --kzcs-light: #f8fafc;
}

.kzcs-container {
    background: linear-gradient(135deg, var(--kzcs-darker) 0%, var(--kzcs-dark) 100%);
    color: #e2e8f0;
    padding: 2rem;
    border-radius: 1rem;
    min-height: 600px;
}

.kzcs-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
}

.kzcs-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kzcs-logo {
    background: linear-gradient(135deg, var(--kzcs-primary) 0%, var(--kzcs-primary-dark) 100%);
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.kzcs-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--kzcs-primary) 0%, var(--kzcs-primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kzcs-title span {
    color: white;
    -webkit-text-fill-color: white;
}

.kzcs-subtitle {
    margin: 0;
    color: #94a3b8;
    font-size: 1.125rem;
}

.kzcs-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .kzcs-layout {
        grid-template-columns: 1fr;
    }
}

/* Editor */
.kzcs-editor-container,
.kzcs-session-info,
.kzcs-participants-container,
.kzcs-invite-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.kzcs-editor-header,
.kzcs-participants-header,
.kzcs-invite-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.kzcs-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.kzcs-section-subtitle {
    font-size: 0.875rem;
    color: #94a3b8;
    margin: 0.25rem 0 0;
}

.kzcs-editor-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.kzcs-editor-wrapper {
    padding: 0.5rem;
}

.CodeMirror {
    border-radius: 0.5rem;
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Buttons */
.kzcs-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.kzcs-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.kzcs-btn-primary {
    background: linear-gradient(135deg, var(--kzcs-primary) 0%, var(--kzcs-primary-dark) 100%);
    color: white;
}

.kzcs-btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-2px);
}

.kzcs-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.kzcs-btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.kzcs-btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.kzcs-btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.kzcs-btn-light {
    background: white;
    color: var(--kzcs-primary);
}

.kzcs-btn-light:hover {
    background: #f8fafc;
}

/* Inputs */
.kzcs-input,
.kzcs-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.kzcs-input:focus,
.kzcs-select:focus {
    outline: none;
    border-color: var(--kzcs-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.kzcs-select {
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.kzcs-flex-input {
    display: flex;
    gap: 0.5rem;
}

.kzcs-flex-input .kzcs-input {
    flex: 1;
}

/* Session Info */
.kzcs-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 1.5rem;
}

.kzcs-info-heading {
    color: #06b6d4;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.kzcs-text-sm {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

/* Settings */
.kzcs-settings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kzcs-setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.kzcs-setting-label {
    font-weight: 600;
    margin: 0;
}

.kzcs-setting-desc {
    font-size: 0.875rem;
    color: #94a3b8;
    margin: 0.25rem 0 0;
}

/* Toggle Switch */
.kzcs-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.kzcs-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.kzcs-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #64748b;
    transition: 0.3s;
    border-radius: 24px;
}

.kzcs-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.kzcs-toggle input:checked + .kzcs-toggle-slider {
    background-color: var(--kzcs-primary);
}

.kzcs-toggle input:checked + .kzcs-toggle-slider:before {
    transform: translateX(24px);
}

/* Participants */
.kzcs-participants-list {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.kzcs-participant {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.kzcs-participant:hover {
    background: rgba(255, 255, 255, 0.05);
}

.kzcs-participant-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.kzcs-participant-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--kzcs-success);
    border: 2px solid var(--kzcs-dark);
    border-radius: 50%;
}

.kzcs-participant-info {
    flex: 1;
}

.kzcs-participant-name {
    font-weight: 600;
    margin: 0;
}

.kzcs-participant-status-text {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0.25rem 0 0;
}

.kzcs-participant-icon {
    color: #06b6d4;
}

/* Invite */
.kzcs-invite-content {
    padding: 1rem;
}

.kzcs-invite-form {
    display: flex;
    gap: 0.5rem;
}

.kzcs-invite-form .kzcs-input {
    flex: 1;
}

/* Badges */
.kzcs-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kzcs-badge-primary {
    background: linear-gradient(135deg, #a78bfa 0%, #c084fc 100%);
    color: white;
}

/* Branding Box */
.kzcs-branding-box {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--kzcs-primary) 0%, var(--kzcs-primary-dark) 100%);
    border-radius: 1rem;
    text-align: center;
}

.kzcs-branding-box h4 {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
}

.kzcs-branding-box p {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    opacity: 0.9;
}

.kzcs-text-primary {
    color: var(--kzcs-primary);
}

/* Toast */
.kzcs-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    max-width: 400px;
    transform: translateY(150%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.kzcs-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.kzcs-toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--kzcs-primary) 0%, var(--kzcs-primary-dark) 100%);
    color: white;
    flex-shrink: 0;
}

.kzcs-toast-icon.error {
    background: var(--kzcs-error);
}

.kzcs-toast-icon.success {
    background: var(--kzcs-success);
}

.kzcs-toast-content h4 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.kzcs-toast-content p {
    margin: 0;
    font-size: 0.875rem;
    color: #94a3b8;
}

/* Empty State */
.kzcs-empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.kzcs-empty-state i {
    font-size: 5rem;
    color: var(--kzcs-primary);
    margin-bottom: 1rem;
}

.kzcs-empty-state h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem;
}

.kzcs-empty-state p {
    color: #94a3b8;
    margin-bottom: 2rem;
}

/* Scrollbar */
.kzcs-participants-list::-webkit-scrollbar {
    width: 8px;
}

.kzcs-participants-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.kzcs-participants-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.kzcs-participants-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .kzcs-container {
        padding: 1rem;
    }
    
    .kzcs-main-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .kzcs-title {
        font-size: 1.75rem;
    }
    
    .kzcs-editor-header,
    .kzcs-participants-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .kzcs-editor-controls {
        width: 100%;
    }
    
    .kzcs-select,
    .kzcs-btn-small {
        width: 100%;
    }
    
    .kzcs-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Fullscreen Mode ===== */
/* The outermost .kzcs-container goes fixed fullscreen (same pattern as notepad plugin) */
.kzcs-container.kzcs-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #282a36 !important;
    overflow: hidden !important;
}

/* Hide everything inside the container except the editor */
.kzcs-container.kzcs-fullscreen .kzcs-main-header {
    display: none !important;
}

.kzcs-container.kzcs-fullscreen .kzcs-sidebar {
    display: none !important;
}

.kzcs-container.kzcs-fullscreen .kzcs-session-info {
    display: none !important;
}

/* Make the layout fill the screen */
.kzcs-container.kzcs-fullscreen .kzcs-layout {
    display: flex !important;
    height: 100vh !important;
    width: 100% !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Editor column fills full width */
.kzcs-container.kzcs-fullscreen .kzcs-editor-column {
    width: 100% !important;
    height: 100vh !important;
    flex: 1 !important;
    max-width: 100% !important;
}

/* Editor container fills the column */
.kzcs-container.kzcs-fullscreen .kzcs-editor-container {
    height: 100vh !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: none !important;
    border: none !important;
    background: #282a36 !important;
}

/* Keep editor header visible with dark theme */
.kzcs-container.kzcs-fullscreen .kzcs-editor-header {
    display: flex !important;
    flex-shrink: 0 !important;
    padding: 12px 20px !important;
    background: #1e1f29 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.kzcs-container.kzcs-fullscreen .kzcs-editor-header .kzcs-section-title {
    color: #f8f8f2 !important;
}

.kzcs-container.kzcs-fullscreen .kzcs-editor-header .kzcs-section-subtitle {
    color: #6272a4 !important;
}

.kzcs-container.kzcs-fullscreen .kzcs-editor-header .kzcs-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f8f8f2 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.kzcs-container.kzcs-fullscreen .kzcs-editor-header .kzcs-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.kzcs-container.kzcs-fullscreen .kzcs-editor-header .kzcs-select {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f8f8f2 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Editor wrapper fills remaining space */
.kzcs-container.kzcs-fullscreen .kzcs-editor-wrapper {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 0 !important;
    min-height: 0 !important;
}

/* CodeMirror fills the wrapper */
.kzcs-container.kzcs-fullscreen .CodeMirror {
    flex: 1 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    border-radius: 0 !important;
}

/* Fullscreen exit button */
.kzcs-fullscreen-exit {
    position: fixed !important;
    top: 12px !important;
    right: 20px !important;
    z-index: 1000000 !important;
    background: rgba(255, 85, 85, 0.9) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    display: none !important;
    align-items: center !important;
    gap: 8px !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
    font-weight: 500 !important;
}

.kzcs-fullscreen-exit:hover {
    background: rgba(255, 50, 50, 1) !important;
    transform: scale(1.05) !important;
}

.kzcs-container.kzcs-fullscreen .kzcs-fullscreen-exit {
    display: flex !important;
}
