/* ============================================================
   RimePages Modern CSS — pages.rimesoft.com / sivut.rimesoft.fi
   ============================================================ */

:root {
    --rp-primary:      #6366F1;
    --rp-primary-dark: #4F46E5;
    --rp-primary-light:#EEF2FF;
    --rp-success:      #10B981;
    --rp-surface:      #0f1e35;
    --rp-bg:           #0a1628;
    --rp-border:       #1e3a5f;
    --rp-text:         #e2e8f0;
    --rp-muted:        #94a3b8;
    --rp-radius:       12px;
    --rp-shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(99,102,241,.06);

    /* Keep Bootstrap compat vars */
    --primary-color:   #6366F1;
    --primary-dark:    #4F46E5;
    --bg-secondary:    #0a1628;
    --bg-tertiary:     #162540;
    --border-color:    #E2E8F0;
    --text-primary:    #e2e8f0;
    --text-secondary:  #94a3b8;
    --danger-color:    #EF4444;
    --shadow-sm:       0 1px 3px rgba(0,0,0,.1);
    --shadow-lg:       0 10px 15px -3px rgba(0,0,0,.1);
    --radius-md:       0.5rem;
    --radius-lg:       0.75rem;
}

body {
    background: var(--rp-bg);
    color: var(--rp-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

/* ---- NAVBAR ---- */
.navbar {
    background: linear-gradient(135deg, #162540 0%, #243d5c 100%) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    padding: .75rem 0;
}
.navbar-brand { font-weight: 700; font-size: 1.15rem; letter-spacing: -.3px; }
.rp-brand { color: #fff; }
.navbar-nav .nav-link {
    color: rgba(255,255,255,.8) !important;
    font-weight: 500;
    border-radius: .375rem;
    padding: .4rem .9rem !important;
    transition: all .2s;
}
.navbar-nav .nav-link:hover { color: #fff !important; background: rgba(255,255,255,.1); }
.navbar-nav .nav-link.active { background: var(--rp-primary); color: #fff !important; }
.logout { color: rgba(255,255,255,.8) !important; }
.logout:hover { color: var(--danger-color) !important; }

/* ---- LANGUAGE SWITCHER ---- */
.rp-lang-btn {
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 500;
    padding: 2px 5px;
    border-radius: 4px;
    transition: color .2s;
}
.rp-lang-btn.active, .rp-lang-btn:hover { color: #fff; }

/* ---- MAIN CONTENT ---- */
main { padding-top: 0 !important; min-height: calc(100vh - 180px); }

/* ---- BUTTONS ---- */
.btn { font-weight: 500; border-radius: var(--radius-md); transition: all .2s; }
.rp-btn-primary {
    background: var(--rp-primary);
    border-color: var(--rp-primary);
    color: #fff !important;
}
.rp-btn-primary:hover {
    background: var(--rp-primary-dark);
    border-color: var(--rp-primary-dark);
    color: #fff !important;
    transform: translateY(-1px);
}
.btn-primary {
    background: linear-gradient(135deg, var(--rp-primary) 0%, var(--rp-primary-dark) 100%);
    border-color: var(--rp-primary);
    color: #fff;
}
.btn-primary:hover { transform: translateY(-1px); }

/* ---- CARDS ---- */
.card, .rp-card {
    background: var(--rp-surface);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow);
}
.card { overflow: hidden; transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-header {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-bottom: 2px solid var(--rp-primary);
    padding: 1.1rem 1.4rem;
    font-weight: 600;
}

/* ---- EMPTY STATE ---- */
.rp-empty-state { max-width: 680px; margin: 2rem auto; }
.rp-empty-icon { font-size: 4.5rem; margin-bottom: .75rem; }
.rp-empty-title { font-size: 2rem; font-weight: 700; }
.rp-empty-desc { color: var(--rp-muted); }

/* ---- STEP CARDS ---- */
.rp-step-card {
    background: var(--rp-surface);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: var(--rp-shadow);
    height: 100%;
}
.rp-step-number {
    width: 42px; height: 42px;
    background: var(--rp-primary-light);
    color: var(--rp-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem;
    margin: 0 auto 1rem;
}

/* ---- PROJECT CARDS ---- */
.rp-project-card {
    background: var(--rp-surface);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow);
    transition: box-shadow .2s, transform .2s;
    overflow: hidden;
    position: relative;
    isolation: isolate;
}
.rp-project-card:hover {
    box-shadow: 0 4px 20px rgba(99,102,241,.14);
    transform: translateY(-2px);
}
.rp-project-card > * {
    position: relative;
    z-index: 1;
}
.rp-project-card-hero {
    position: absolute;
    inset: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    opacity: .3;
    transform: scale(1.03);
    filter: saturate(1.05) contrast(1.04);
    pointer-events: none;
    z-index: 0;
}
.rp-project-card-has-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 22, 40, .18) 0%, rgba(10, 22, 40, .34) 45%, rgba(10, 22, 40, .56) 100%);
    pointer-events: none;
    z-index: 0;
}
.rp-project-card-has-hero .rp-project-card-header,
.rp-project-card-has-hero .rp-project-card-footer,
.rp-project-card-has-hero .rp-modification-section {
    background: rgba(10, 22, 40, .46);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.rp-project-card-header {
    padding: .85rem 1.2rem;
    background: var(--rp-bg);
    border-bottom: 1px solid var(--rp-border);
}
.rp-project-card-body { padding: 1.2rem; }
.rp-project-card-has-hero .rp-project-card-body {
    background: linear-gradient(180deg, rgba(10, 22, 40, .08) 0%, rgba(10, 22, 40, .22) 100%);
}
.rp-project-card .text-muted {
    color: var(--rp-muted) !important;
}
.rp-project-card-has-hero .text-muted {
    color: rgba(226, 232, 240, .76) !important;
}
.rp-project-card-footer { padding: .85rem 1.2rem; border-top: 1px solid var(--rp-border); }
.rp-modification-section { padding: .75rem 1.2rem; }
.rp-company-name { font-weight: 700; font-size: 1.05rem; margin-bottom: .35rem; }

/* ---- COLOR DOTS ---- */
.rp-color-dot {
    width: 20px; height: 20px; border-radius: 50%;
    display: inline-block; border: 2px solid rgba(0,0,0,.1); flex-shrink: 0;
}
.rp-color-dot-sm {
    width: 12px; height: 12px; border-radius: 50%;
    display: inline-block; border: 1px solid rgba(0,0,0,.1); vertical-align: middle;
}

/* ---- STYLE SELECTOR ---- */
.rp-style-card {
    display: block;
    background: var(--rp-surface);
    border: 2px solid var(--rp-border);
    border-radius: var(--rp-radius);
    padding: 1rem .75rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, background .2s;
    user-select: none;
    height: 100%;
}
.rp-style-card:hover { border-color: var(--rp-primary); }
.rp-style-card.selected {
    border-color: var(--rp-primary);
    background: var(--rp-primary-light);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.rp-style-icon { font-size: 1.8rem; margin-bottom: .4rem; }
.rp-style-label { font-size: .9rem; }
.rp-style-desc { font-size: .75rem; margin-top: .25rem; line-height: 1.3; }

/* ---- WIZARD ---- */
.rp-wizard-header { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.rp-wizard-step {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--rp-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.rp-wizard-step:not(.active) { background: var(--rp-border); color: var(--rp-muted); }
.rp-wizard-label { min-width: 0; margin-left: .75rem; }
.rp-wizard-line { flex: 1; height: 2px; background: var(--rp-border); margin: 0 1rem; min-width: 20px; }

/* ---- FORM ---- */
.rp-form .form-label { font-weight: 500; }
.form-control:focus {
    border-color: var(--rp-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.rp-form .form-control,
.rp-form .form-select,
.rp-form textarea,
.rp-form input,
.rp-form select {
    color: var(--text-primary);
}
.rp-form .form-control::placeholder,
.rp-form textarea::placeholder,
.rp-form input::placeholder {
    color: #94a3b8;
}
.rp-form .text-muted,
.rp-form .form-text {
    color: var(--text-secondary) !important;
}
.rp-info-notice {
    border-left: 4px solid var(--rp-primary);
    background: var(--rp-primary-light);
    color: var(--rp-primary-dark);
    border-color: transparent;
}

/* ---- LIGHT SURFACES ---- */
.rp-intake-toolbar,
.rp-intake-step,
.rp-intake-preview-stage {
    color: #0f172a;
}

.rp-intake-toolbar h1,
.rp-intake-toolbar h2,
.rp-intake-toolbar h3,
.rp-intake-toolbar h4,
.rp-intake-toolbar h5,
.rp-intake-toolbar h6,
.rp-intake-step h1,
.rp-intake-step h2,
.rp-intake-step h3,
.rp-intake-step h4,
.rp-intake-step h5,
.rp-intake-step h6,
.rp-intake-preview-stage h1,
.rp-intake-preview-stage h2,
.rp-intake-preview-stage h3,
.rp-intake-preview-stage h4,
.rp-intake-preview-stage h5,
.rp-intake-preview-stage h6,
.rp-intake-step .form-label,
.rp-intake-step .form-check-label,
.rp-intake-step .invalid-feedback {
    color: #0f172a;
}

.rp-intake-toolbar p,
.rp-intake-toolbar .text-muted,
.rp-intake-step p,
.rp-intake-step .text-muted,
.rp-intake-step .form-text,
.rp-intake-preview-stage p,
.rp-intake-preview-stage .text-muted {
    color: #475569 !important;
}

.rp-intake-step .form-control,
.rp-intake-step .form-select,
.rp-intake-step textarea,
.rp-intake-step input:not([type="submit"]):not([type="button"]):not([type="radio"]):not([type="checkbox"]):not([type="color"]),
.rp-intake-step select,
.rp-intake-preview-stage .form-control,
.rp-intake-preview-stage .form-select {
    color: #0f172a;
    background-color: #fff;
}

.rp-intake-step .form-control::placeholder,
.rp-intake-step textarea::placeholder,
.rp-intake-step input::placeholder {
    color: #94a3b8;
}

/* Style cards inside light-themed intake steps */
.rp-intake-step .rp-style-card {
    background: #fff;
    border-color: rgba(148, 163, 184, 0.3);
    color: #0f172a;
}
.rp-intake-step .rp-style-card:hover {
    border-color: var(--rp-primary);
}
.rp-intake-step .rp-style-card.selected {
    background: #EEF2FF;
    border-color: var(--rp-primary);
    color: #0f172a;
}
.rp-intake-step .rp-style-card .rp-style-label {
    color: #0f172a;
}
.rp-intake-step .rp-style-card .rp-style-desc {
    color: #475569;
}

/* ---- TEXT BLOCKS ---- */
.rp-text-block {
    background: var(--rp-bg); border: 1px solid var(--rp-border);
    border-radius: 8px; padding: .75rem 1rem;
    white-space: pre-wrap; font-size: .9rem; line-height: 1.6;
}

/* ---- COMPLETED CARD ---- */
.rp-completed-card { border-left: 4px solid var(--rp-success) !important; }

/* ---- FOOTER ---- */
.rp-footer, .footer {
    background: var(--rp-surface);
    border-top: 1px solid var(--rp-border);
    font-size: .85rem;
}

/* ---- ALERTS ---- */
.alert { border-radius: var(--rp-radius); border-left: 4px solid; }
.alert-success { background: #d1fae5; border-left-color: var(--rp-success); color: #065f46; }
.alert-danger { background: #fee2e2; border-left-color: var(--danger-color); color: #991b1b; }
.alert-info { background: #dbeafe; border-left-color: #0ea5e9; color: #075985; }
.alert-warning { background: #fef9c3; border-left-color: #f59e0b; color: #78350f; }

/* ---- TABLE ---- */
.table {
    background: var(--rp-surface);
    color: var(--rp-text);
    --bs-table-color: var(--rp-text);
    --bs-table-bg: var(--rp-surface);
    --bs-table-border-color: var(--rp-border);
    --bs-table-hover-color: #ffffff;
    --bs-table-hover-bg: var(--rp-bg);
}
.table > :not(caption) > * > * {
    color: var(--rp-text);
    background-color: transparent;
    box-shadow: none;
}
.table thead th {
    background: var(--bg-tertiary);
    font-size: .8rem; text-transform: uppercase;
    letter-spacing: .05em; color: #f8fafc;
    border-bottom: 2px solid var(--rp-border);
}
.table tbody tr:hover { background: var(--rp-bg); }
.table tbody td {
    color: var(--rp-text);
    border-bottom: 1px solid var(--rp-border);
    vertical-align: middle;
}
.table .text-muted,
.table small,
.table .small {
    color: #cbd5e1 !important;
}
.table a:not(.btn) {
    color: #f8fafc;
}

/* ---- BADGE OVERRIDES ---- */
.badge { font-size: .78rem; padding: .3em .6em; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    main { padding-top: 0 !important; }
    .rp-wizard-header { gap: .5rem; }
    .rp-wizard-line { display: none; }
}

/* ---- NAV TABS (dark theme) ---- */
.nav-tabs {
    border-bottom-color: var(--rp-border);
}
.nav-tabs .nav-link {
    color: var(--rp-muted);
    background: transparent;
    border-color: transparent;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-weight: 500;
    transition: color .15s, background .15s;
}
.nav-tabs .nav-link:hover {
    color: var(--rp-text);
    background: var(--rp-surface);
    border-color: var(--rp-border) var(--rp-border) transparent;
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-link.active:focus {
    color: var(--rp-primary);
    background: var(--rp-surface);
    border-color: var(--rp-border) var(--rp-border) var(--rp-surface);
    font-weight: 600;
}

/* Tab content area */
.rp-tab-content {
    background: var(--rp-surface);
    border: 1px solid var(--rp-border);
    border-top: none;
    border-radius: 0 0 var(--rp-radius) var(--rp-radius);
    padding: 1.25rem 1.25rem 0.25rem;
}
@media (min-width: 768px) {
    .rp-tab-content { padding: 1.5rem 1.5rem 0.25rem; }
}

/* Cards nested inside tab panels — use deeper bg for contrast */
.rp-tab-content .rp-card {
    background: var(--rp-bg);
    border-color: var(--rp-border);
}

/* ---- FORM CONTROLS (dark theme global) ---- */
.form-control,
.form-select {
    background-color: var(--rp-bg);
    border-color: var(--rp-border);
    color: var(--rp-text);
}
.form-control:focus,
.form-select:focus {
    background-color: var(--rp-bg);
    border-color: var(--rp-primary);
    color: var(--rp-text);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-control::placeholder,
textarea::placeholder,
input::placeholder {
    color: var(--rp-muted);
}
.form-control:disabled,
.form-control[readonly] {
    background-color: var(--rp-surface);
    color: var(--rp-muted);
}

/* ---- CHANGE TYPE CARDS ---- */
.rp-change-type-card {
    background: var(--rp-bg);
    border-color: var(--rp-border) !important;
    color: var(--rp-text);
    transition: border-color .15s, box-shadow .15s;
    cursor: pointer;
    user-select: none;
}
.rp-change-type-card:hover {
    border-color: var(--rp-primary) !important;
    box-shadow: 0 0 0 2px rgba(99,102,241,.2);
}
.rp-change-type-card.active {
    border-color: var(--rp-primary) !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,.25);
    background: #12224a;
}
.rp-change-type-card .text-muted {
    color: var(--rp-muted) !important;
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
.fade-in { animation: fadeIn .5s ease-out; }
