/* cv/static/cv/css/cv_style.css */

/* 1. APP-SPECIFIC FORM STYLING 
   We want strict, uniform inputs for the Resume Builder data entry. */
.form-input, 
input[type="text"], 
input[type="email"], 
input[type="url"], 
input[type="date"],
textarea, 
select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Fix for "I currently work here" checkbox being huge */
input[type="checkbox"] {
    width: auto !important;  /* Override the global 100% width */
    margin-right: 10px;      /* Add space between box and text */
    height: 1.2rem;          /* Make it slightly larger for easy clicking */
    width: 1.2rem !important;
    vertical-align: middle;
}

.form-input:focus, 
textarea:focus {
    outline: none;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* 2. SETTINGS PAGE LAYOUT (Desktop Default) */
.settings-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
}

.settings-sidebar {
    width: 100px;
    position: sticky;
    top: 20px;
    flex-shrink: 0; 
}

/* 3. MOBILE RESPONSIVENESS (CV App Only) */
@media (max-width: 768px) {
    
    /* Stack the layout */
    .settings-layout {
        flex-direction: column;
        gap: 20px;
    }

    /* Make sidebar flat and merge with background */
    .settings-sidebar {
        width: 100%;
        position: static;
        background: var(--bg-color);
        border-bottom: none;
        padding-bottom: 0; 
        margin-bottom: 10px;
    }

    /* HIDE the navigation links (Basic, Experience...) on mobile */
    .sidebar-nav-links {
        display: none !important;
    }

    /* Force the buttons (Dashboard/Sign Out) to sit side-by-side */
    .settings-sidebar div:last-child {
        flex-direction: row !important;
    }
}


/* Ensure long text (like URLs or long summaries) doesn't break the layout */
.app-card p, 
.auth-card p,
.form-group,
textarea {
    overflow-wrap: break-word;   /* Break long words if necessary */
    word-wrap: break-word;       /* Legacy support */
    hyphens: auto;               /* Add hyphens cleanly */
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    /* ... existing rules ... */

    .settings-layout {
        flex-direction: column;
        gap: 0; /* Remove gap since sidebar is gone */
    }

    /* COMPLETELY HIDE SIDEBAR ON MOBILE */
    /* Since links are hidden and buttons are moved, this is now empty space */
    .settings-sidebar {
        display: none !important;
    }
}

/* --- LAYOUT BALANCING (Center the Content, not the Group) --- */

.layout-balancer {
    width: 100px;       /* Must match .settings-sidebar width */
    flex-shrink: 0;     /* Prevent it from getting squashed */
    display: block;
}

/* Ensure the Main Content doesn't stretch too wide */
/* We remove flex: 1 effectively and give it a solid width behavior */
.settings-layout > div:nth-child(2) {
    width: 100%;
    max-width: 700px;
}

/* HIDE ON SMALL SCREENS (Tablets & Mobile) */
/* When screen is narrower than ~1300px, we don't have room for the ghost col. */
@media (max-width: 1280px) {
    .layout-balancer {
        display: none;
    }
    
    /* Revert to standard centering (Content + Sidebar) on mid-size screens */
    .settings-layout {
        justify-content: center; 
    }
}

/* --- RESUME BUILDER SELECTION UI --- */

/* Grid for Experience/Education items */
.selection-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selection-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: flex-start; /* Align checkbox to top for multi-line text */
    transition: border-color 0.2s;
}

.selection-item:hover {
    border-color: var(--theme-color);
}

/* Skills styling (Pill shape selection) */
.skill-selector {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 14px;
    transition: background-color 0.2s;
}

.skill-selector:hover {
    border-color: var(--theme-color);
}

/* Make the checkbox and label sit nicely together */
.skill-selector input[type="checkbox"] {
    margin-right: 8px !important;
    width: 1em !important;
    height: 1em !important;
}

.skill-selector label {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Specific Grid Fix for CV Dashboard Only */
/* We target the container inside the CV dashboard specifically */

@media (max-width: 480px) {
    .cv-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* FIXING THE STRETCH */
.cv-dashboard-grid {
    display: grid;
    /* Keeps the column logic */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    justify-content: center;
    
    /* PREVENT VERTICAL STRETCHING: 
       "start" makes cards only as tall as their content, 
       instead of forcing them to match the tallest card in the row. */
    align-items: start; 
}

/* Update the card itself to prevent becoming too wide on large screens */
.app-card {
    /* ... existing styles ... */
    
    /* ADD THIS to prevent them from looking ridiculous on huge monitors */
    max-width: 100%; 
    /*width: 100%;*/
    margin: 0 auto; /* Centers the card in its grid cell if it's smaller */
}

.form-input {
    max-width: 100%; /* Ensures the box fills the card */
    /* ... other styles ... */
}

/* TOGGLE SWITCH CSS */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

/* Checked State (Green) */
input:checked + .slider {
  background-color: #10b981; /* Emerald Green */
}

input:checked + .slider:before {
  transform: translateX(16px);
}
