/* KRAMEL Project Tracking — KRAMEL Brand Style */

:root {
    --bg: #07080a;
    --bg2: #0b0d12;
    --card: #0c0f16;
    --text: #e9ecf1;
    --muted: #a8b0bf;
    --faint: #707a8c;
    --line: rgba(255,255,255,.10);
    --line2: rgba(255,255,255,.06);
    --accent: #e9ecf1;
    --accent2: #c7d2ff;
    --gold: #d6c08a;
    --shadow: 0 30px 90px rgba(0,0,0,.55);
    --radius: 20px;
    --radius2: 14px;
}

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

html, body {
    height: 100%;
}

body {
    font-family: Montserrat, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: linear-gradient(180deg, var(--bg), var(--bg2));
    color: var(--text);
    overflow-x: hidden;
}

.app-wrapper {
    height: 100vh;
    overflow: hidden;
}

.screen {
    display: none;
    height: 100vh;
    overflow-y: auto;
    animation: fadeIn 0.3s;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

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

/* LOGIN SCREEN */
#login-screen.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 400px;
    width: 100%;
}

.login-container h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
}

.login-subtitle {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: 0.05em;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* HEADER */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(7, 8, 10, 0.55);
    border-bottom: 1px solid var(--line2);
    padding: 20px;
}

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

.app-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.btn-logout {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 8px 14px;
    border-radius: var(--radius2);
    cursor: pointer;
    font-size: 12px;
    font-family: Montserrat, sans-serif;
    transition: all 0.2s;
}

.btn-logout:hover {
    border-color: var(--accent2);
    color: var(--accent);
}

.btn-back {
    background: transparent;
    color: var(--muted);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-family: Montserrat, sans-serif;
    padding: 0;
}

.btn-back:hover {
    color: var(--accent);
}

/* MAIN CONTENT */
.app-main {
    flex: 1;
    overflow-y: auto;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding: 30px 20px;
}

/* SECTIONS */
.section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius2);
    padding: 24px;
    margin-bottom: 24px;
}

.section-header {
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

/* FORMS */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.form-full {
    grid-column: 1 / -1;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.label-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

input, select, textarea {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius2);
    font-size: 13px;
    font-family: Montserrat, sans-serif;
    background: rgba(199, 210, 255, 0.04);
    color: var(--text);
    transition: all 0.2s;
}

/* Optimize native dropdown colors (where browser allows) */
select {
    background-color: rgba(199, 210, 255, 0.04);
    color: var(--text);
}

select option {
    background-color: #0b0d12;
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(214, 192, 138, 0.06);
    box-shadow: 0 0 0 3px rgba(214, 192, 138, 0.10);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

/* BUTTONS */
.btn-primary {
    background: rgba(214, 192, 138, 0.12);
    color: var(--gold);
    padding: 10px 16px;
    border: 1px solid var(--gold);
    border-radius: var(--radius2);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-family: Montserrat, sans-serif;
}

.btn-primary:hover {
    background: rgba(214, 192, 138, 0.24);
    box-shadow: 0 0 0 3px rgba(214, 192, 138, 0.12);
}

.btn-secondary {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 8px 14px;
    border-radius: var(--radius2);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-family: Montserrat, sans-serif;
}

.btn-secondary:hover {
    border-color: var(--accent2);
    background: rgba(199, 210, 255, 0.08);
    color: var(--accent);
}

.btn-large {
    padding: 12px 24px;
    font-size: 13px;
    width: 100%;
}

.btn-copy {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 6px 10px;
    border-radius: var(--radius2);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.btn-copy:hover {
    border-color: var(--accent2);
    color: var(--accent);
}

/* ADD STAGE FORM */
.add-stage-form {
    background: rgba(199, 210, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: var(--radius2);
    padding: 16px;
    margin-top: 16px;
}

.add-stage-form.hidden {
    display: none;
}

.add-stage-form h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* STAGES LIST */
.stages-preview {
    background: rgba(199, 210, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: var(--radius2);
    padding: 16px;
    margin-top: 16px;
}

.stages-preview.hidden {
    display: none;
}

.stages-preview h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.stages-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stages-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(199, 210, 255, 0.04);
    border-radius: var(--radius2);
    font-size: 12px;
}

/* PROJECTS LIST */
.projects-list {
    display: grid;
    gap: 16px;
}

.project-card {
    background: rgba(199, 210, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: var(--radius2);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.project-card:hover {
    background: rgba(199, 210, 255, 0.06);
    border-color: var(--accent2);
}

.project-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.project-card-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
}

.project-card-progress {
    background: rgba(199, 210, 255, 0.04);
    border-radius: var(--radius2);
    height: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.project-card-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--accent2));
}

/* PROJECT INFO */
.project-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--line2);
    font-size: 13px;
}

.info-row .label {
    font-weight: 600;
    color: var(--muted);
}

.info-row input {
    flex: 1;
    margin: 0 12px;
}

/* STAGES EDITOR */
.stages-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stage-editor-item {
    background: rgba(199, 210, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: var(--radius2);
    padding: 16px;
}

.stage-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.stage-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 12px 0 14px;
}

.kpi {
    background: rgba(199, 210, 255, 0.03);
    border: 1px solid var(--line2);
    border-radius: 14px;
    padding: 12px;
}

.kpi-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.kpi-value {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.health-pill {
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: rgba(199, 210, 255, 0.03);
    white-space: nowrap;
}

.health-pill.green {
    border-color: rgba(120, 255, 170, 0.35);
    color: rgba(170, 255, 210, 0.95);
    background: rgba(120, 255, 170, 0.06);
}

.health-pill.orange {
    border-color: rgba(255, 185, 90, 0.35);
    color: rgba(255, 210, 160, 0.95);
    background: rgba(255, 185, 90, 0.06);
}

.health-pill.red {
    border-color: rgba(255, 90, 90, 0.35);
    color: rgba(255, 180, 180, 0.95);
    background: rgba(255, 90, 90, 0.06);
}

.worklog-box {
    background: rgba(199, 210, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin: 12px 0;
}

.worklog-add {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    align-items: end;
}

.worklog-note {
    grid-column: 1 / -1;
}

.worklog-title {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 10px 0 6px;
}

.worklog-empty {
    margin-top: 10px;
    font-size: 11px;
    color: var(--muted);
}

.worklog-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.worklog-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line2);
    border-radius: 14px;
    background: rgba(199, 210, 255, 0.02);
}

.wl-date {
    font-size: 11px;
    color: var(--muted);
}

.wl-val {
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}

.wl-note {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

.stage-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line2);
}

.stage-editor-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.stage-status-select {
    width: 150px;
}

.stage-progress {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.stage-progress input {
    width: 60px;
}

.upload-photos {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.upload-photos input[type="file"] {
    display: none;
}

.btn-upload {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 8px 12px;
    border-radius: var(--radius2);
    cursor: pointer;
    font-size: 12px;
    font-family: Montserrat, sans-serif;
}

.btn-upload:hover {
    border-color: var(--accent2);
    color: var(--accent);
}

.photo-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.photo-thumb {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(199, 210, 255, 0.04);
    cursor: pointer;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 24px;
}

.photo-modal.active {
    display: flex;
}

.photo-modal-content {
    width: min(980px, 96vw);
    max-height: 90vh;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.photo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line2);
}

.photo-modal-header .title {
    font-size: 12px;
    color: var(--muted);
}

.photo-modal-close {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 12px;
    padding: 6px 10px;
    cursor: pointer;
}

.photo-modal-close:hover {
    border-color: var(--accent2);
    color: var(--accent);
}

.photo-modal-body {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.photo-modal-body img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    background: #0b0d12;
    border-radius: 14px;
}

.btn-danger {
    background: rgba(255, 77, 77, 0.10);
    border: 1px solid rgba(255, 77, 77, 0.55);
    color: #ffb3b3;
    padding: 8px 12px;
    border-radius: var(--radius2);
    cursor: pointer;
    font-size: 12px;
    font-family: Montserrat, sans-serif;
}

.btn-danger:hover {
    background: rgba(255, 77, 77, 0.18);
}

/* CLIENT VIEW */
.client-view .app-header {
    border-bottom: 1px solid var(--line);
}

.progress-summary {
    background: rgba(199, 210, 255, 0.04);
    border-radius: var(--radius2);
    padding: 24px;
}

.progress-summary h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

.progress-bar-container {
    margin-bottom: 24px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}

.progress-bar {
    height: 8px;
    background: rgba(199, 210, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--accent2));
    transition: width 0.3s;
}

.timeline-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.timeline-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-item .label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
}

.timeline-item .value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

/* CLIENT TOTALS */
.client-totals {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.totals-item {
    background: rgba(199, 210, 255, 0.03);
    border: 1px solid var(--line2);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.totals-item .k {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.totals-item .v {
    font-size: 12px;
    font-weight: 600;
}

/* CLIENT STAGES */
.client-stages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-stage {
    background: rgba(199, 210, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: var(--radius2);
    padding: 16px;
}

.client-stage-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.client-stage-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line2);
    border-radius: 14px;
    background: rgba(199, 210, 255, 0.02);
}

.meta-item .k {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.meta-item .v {
    font-size: 12px;
    font-weight: 600;
}

.client-stage-progress {
    margin-top: 10px;
}

.client-stage-photos {
    margin-top: 14px;
}

.photos-title {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
}

.client-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 10px;
}

.stage-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.stage-status-badge {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--faint);
}

.stage-status-badge.done {
    background: var(--gold);
}

.stage-status-badge.active {
    background: var(--accent2);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.stage-dates {
    font-size: 11px;
    color: var(--muted);
    margin: 4px 0;
}

/* GALLERY */
.client-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.gallery-item {
    border-radius: var(--radius2);
    overflow: hidden;
    background: rgba(199, 210, 255, 0.04);
}

.gallery-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.gallery-item-info {
    padding: 8px;
    font-size: 10px;
    color: var(--muted);
}

/* CLIENT FOOTER */
.client-footer {
    color: var(--muted);
    font-size: 11px;
}

.client-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.client-footer a {
    color: var(--accent2);
    text-decoration: none;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .app-main {
        padding: 20px 15px;
    }

    .form-grid, .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .timeline-info {
        grid-template-columns: 1fr;
    }

    .btn-large {
        width: 100%;
    }

    .login-container {
        margin: 20px;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}
