/* Oakland Canvas Builder - Main Styles (portal.oakcs.dev look) */

:root {
    /* Portal / OCU Brand (portal.oakcs.dev) */
    --ocu-navy: #1A3374;
    --ocu-navy-dark: #122552;
    --ocu-columbia: #76AFE3;
    --ocu-columbia-light: #9bc4ed;
    --ocu-gold: #C9A227;
    --ocu-gold-light: #E5C653;
    --ocu-white: #ffffff;
    --ocu-off-white: #f5f8fc;
    --ocu-grey-light: #E8ECF0;
    --ocu-grey: #6B7280;
    --ocu-text: #1a1a2e;
    --ocu-text-muted: #4a5568;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
    
    /* Legacy aliases for components */
    --ocu-primary: var(--ocu-navy);
    --ocu-secondary: var(--ocu-gold);
    --ocu-link: var(--ocu-navy);
    --ocu-secondary-btn: var(--ocu-columbia);
    --ocu-secondary-btn-text: var(--ocu-navy);
    --ocu-dark: var(--ocu-text);
    --ocu-light: var(--ocu-off-white);
    --ocu-accent: var(--ocu-columbia);
    
    /* UI Colors */
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
    --light-gray: var(--ocu-grey-light);
    --border-color: rgba(26, 51, 116, 0.12);
    
    /* Typography */
    --font-family: var(--font-sans);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(26, 51, 116, 0.06);
    --shadow-md: 0 4px 12px rgba(26, 51, 116, 0.08);
    --shadow-lg: 0 8px 24px rgba(26, 51, 116, 0.1);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--ocu-text);
    background: var(--ocu-off-white);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

/* Site Header (portal-style: white bar, gold bottom border) */
.site-header {
    background: var(--ocu-white);
    border-bottom: 3px solid var(--ocu-gold);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 1.25rem 1.5rem;
}

.header-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-logo-and-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-logo {
    display: block;
    flex-shrink: 0;
}

.header-logo img {
    height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

@media (min-width: 480px) {
    .header-logo img {
        height: 48px;
        max-width: 260px;
    }
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.header-department {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ocu-grey);
    letter-spacing: 0.02em;
}

.header-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--ocu-navy);
    margin: 0;
    letter-spacing: -0.02em;
}

.header-pipe {
    color: var(--ocu-grey);
    font-weight: 400;
    margin-right: 0.15em;
}

.header-tagline {
    font-size: 0.9rem;
    color: var(--ocu-text-muted);
    margin: 0;
    font-style: italic;
}

@media (max-width: 640px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Content cards (portal-style) */
.content-card {
    background: var(--ocu-white);
    border: 1px solid rgba(26, 51, 116, 0.08);
    border-radius: var(--radius-md);
    padding: 1.75rem 2rem;
    margin-bottom: var(--spacing-lg);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.content-card:hover {
    border-color: rgba(26, 51, 116, 0.14);
    box-shadow: 0 4px 24px rgba(26, 51, 116, 0.06);
}

/* Welcome Section */
.welcome-section {
    margin-bottom: var(--spacing-lg);
}

.welcome-content h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 1.75rem);
    color: var(--ocu-navy);
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.welcome-intro,
.welcome-content p {
    font-size: 1.0625rem;
    color: var(--ocu-text-muted);
    margin: 0 0 1.5rem;
    max-width: 60ch;
    line-height: 1.6;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: var(--ocu-navy-dark);
}

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

.btn-success:hover {
    background: #218838;
}

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

.btn-info:hover {
    background: #138496;
}

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

.btn-danger:hover {
    background: #c82333;
}

/* Action Menu */
.action-menu {
    margin-bottom: var(--spacing-lg);
}

.action-menu h3 {
    font-family: var(--font-display);
    color: var(--ocu-navy);
    margin: 0 0 var(--spacing-md);
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* Content Menu */
.content-menu {
    margin-bottom: var(--spacing-lg);
}

.content-menu h3 {
    font-family: var(--font-display);
    color: var(--ocu-navy);
    margin: 0 0 var(--spacing-md);
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-sm);
}

.component-btn {
    padding: var(--spacing-md);
    background: var(--ocu-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ocu-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.component-btn i {
    font-size: 1.8rem;
    color: var(--ocu-navy);
}

.component-btn:hover {
    background: var(--ocu-navy);
    color: var(--ocu-white);
    border-color: var(--ocu-navy);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 51, 116, 0.2);
}

.component-btn:hover i {
    color: var(--ocu-gold-light);
}

/* Editor Section */
.editor-section {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.editor-section h3 {
    color: var(--ocu-primary);
    margin-bottom: var(--spacing-md);
    font-size: 1.5rem;
}

/* WYSIWYG toolbar above editor */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.editor-toolbar button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--ocu-white);
    color: var(--ocu-navy);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background 0.2s, border-color 0.2s;
}

.editor-toolbar button:hover {
    background: var(--ocu-grey-light);
    border-color: var(--ocu-navy);
}

.editor-toolbar button[data-format] {
    width: auto;
    padding: 0 0.5rem;
    font-weight: 600;
}

.toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 2px;
}

.toolbar-color-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.toolbar-color-wrap input[type="color"] {
    width: 28px;
    height: 28px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: var(--ocu-white);
}

.toolbar-color-wrap .toolbar-hex-input {
    width: 72px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: monospace;
}

.toolbar-color-wrap .toolbar-hex-input:focus {
    outline: none;
    border-color: var(--ocu-navy);
}

.toolbar-color-wrap #editor-apply-color {
    height: 30px;
    padding: 0 0.6rem;
    font-size: 0.8rem;
}

/* Drag handle in component controls bar */
.component-drag-handle {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
    color: var(--ocu-grey);
    cursor: move;
}

.component-drag-handle:hover {
    color: var(--ocu-navy);
}

.editor {
    min-height: 520px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    background: var(--ocu-white);
    outline: none;
    overflow-y: auto;
    cursor: text;
}

.editor:focus {
    border-color: var(--ocu-navy);
    box-shadow: 0 0 0 3px rgba(26, 51, 116, 0.12);
}

.get-started {
    text-align: center;
    color: var(--ocu-grey);
    font-size: 1.3rem;
    padding: var(--spacing-xl) 0;
}

.get-started i {
    font-size: 3rem;
    color: var(--ocu-navy);
    display: block;
    margin-bottom: var(--spacing-sm);
}

/* Video wrapper in editor: ensure visible height (iframes can be stripped in contenteditable) */
.editor .bc-video-wrapper {
    min-height: 280px;
}
/* Video placeholder in editor (real iframe is inserted when copying to Canvas) */
.editor .bc-video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    background: linear-gradient(135deg, #e8ecf0 0%, #d0d8e0 100%);
    border: 2px dashed var(--ocu-grey);
    border-radius: 8px;
    color: var(--ocu-grey);
    text-align: center;
    padding: 1.5rem;
}

.editor .bc-video-placeholder-icon {
    font-size: 3rem;
    color: var(--ocu-navy);
    margin-bottom: 0.5rem;
}

.editor .bc-video-placeholder-text {
    font-size: 0.95rem;
}

/* Component Items in Editor – live editable; drag only via controls bar */
.component-item {
    background: var(--ocu-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    position: relative;
    transition: all 0.2s ease;
}

.component-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--ocu-navy);
}

.component-item.ui-sortable-helper {
    box-shadow: var(--shadow-lg);
    transform: scale(1.02);
}

/* Drag handle: only this bar starts drag; rest of component is live edit */
.component-controls {
    position: absolute;
    top: var(--spacing-xs);
    right: var(--spacing-xs);
    display: flex;
    gap: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    cursor: move;
}

.component-item:hover .component-controls {
    opacity: 1;
}

.component-control-btn {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.component-control-btn:hover {
    background: var(--ocu-navy);
    color: var(--ocu-white);
    border-color: var(--ocu-navy);
}

.component-control-btn.delete:hover {
    background: var(--danger);
    border-color: var(--danger);
}

/* Builder Panel */
.builder-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.builder-panel.active {
    right: 0;
}

.builder-header {
    background: var(--ocu-navy);
    color: var(--ocu-white);
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.builder-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--ocu-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
}

.builder-content {
    padding: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--ocu-dark);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 1rem;
}

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--ocu-navy);
    box-shadow: 0 0 0 3px rgba(26, 51, 116, 0.12);
}

/* Canvas-style editor (RCE-like in builder panel) */
.canvas-editor-wrap {
    margin-bottom: var(--spacing-md);
}

.canvas-editor-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ocu-grey);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.canvas-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 8px;
    background: #f2f3f5;
    border: 1px solid #d0d4d9;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.canvas-editor-toolbar button {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #374151;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.canvas-editor-toolbar button:hover {
    background: #e5e7eb;
    color: var(--ocu-navy);
}

.canvas-editor-toolbar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.canvas-editor-body {
    min-height: 200px;
    padding: 12px 14px;
    border: 1px solid #d0d4d9;
    border-radius: 0 0 6px 6px;
    background: var(--ocu-white);
    font-size: 14px;
    line-height: 1.6;
    color: #1f2937;
    outline: none;
    overflow-y: auto;
}

.canvas-editor-body:focus {
    border-color: var(--ocu-navy);
    box-shadow: 0 0 0 2px rgba(26, 51, 116, 0.15);
}

.canvas-editor-body p { margin: 0 0 0.5em; }
.canvas-editor-body ul, .canvas-editor-body ol { margin: 0.5em 0; padding-left: 1.5em; }
.canvas-editor-body h2 { font-size: 1.25em; margin: 0.75em 0 0.35em; }
.canvas-editor-body h3 { font-size: 1.1em; margin: 0.6em 0 0.3em; }

/* Site Footer (portal-style: dark navy, gold top border) */
.site-footer {
    background: var(--ocu-navy-dark);
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0;
    padding: 3rem 1.5rem 1.5rem;
    border-top: 3px solid var(--ocu-gold);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 500px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

.footer-col h4 {
    color: var(--ocu-white);
    font-size: 1rem;
    margin: 0 0 1rem;
    font-family: var(--font-sans);
    font-weight: 600;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col li {
    margin-bottom: 0.5rem;
}

.footer-col a {
    color: var(--ocu-gold-light);
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.footer-col a:hover {
    color: var(--ocu-white);
}

.footer-brand .footer-logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--ocu-white);
    margin-bottom: 0.75rem;
}

.footer-tagline {
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 0 1rem;
    max-width: 360px;
    opacity: 0.9;
}

.footer-contact {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.9;
}

.footer-contact a {
    color: var(--ocu-gold-light);
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
}

.footer-copy {
    font-size: 0.875rem;
    opacity: 0.85;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 2rem 1rem 3rem;
    }
    
    .component-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    .builder-panel {
        width: 100%;
        right: -100%;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

.hidden {
    display: none;
}

/* SweetAlert2 Customization */
.swal2-popup {
    font-family: var(--font-family);
}

.swal2-confirm {
    background-color: var(--ocu-navy) !important;
}

.swal2-cancel {
    background-color: #6c757d !important;
}
