/* GMAIL SKIN FOR ROUNDCUBE ELASTIC2022 - PIXEL PERFECT EDITION v13 */
/* Addressing User Feedback: "Nuovo messaggio merda", "Search border radius / internal padding", "Editor orribile / Invia pulsante mancante" */

/* --- ROOT VARIABLES --- */
:root {
    --gmail-bg: #f6f8fc;
    --gmail-sidebar-bg: #f6f8fc;
    --gmail-white: #ffffff;
    --gmail-text: #1f1f1f;
    --gmail-text-secondary: #444746;
    /* GMAIL BUTTON COLOR "Invia" / "Scrivi" */
    --gmail-button-bg: #c2e7ff;
    --gmail-button-text: #001d35;

    --gmail-accent: #0b57d0;
    --gmail-search-bg: #eaf1fb;
    --gmail-selected-row: rgba(194, 231, 255, 0.4);
    --font-family: 'Google Sans', 'Roboto', Roboto, Arial, sans-serif;
}

/* --- RESETS --- */
body {
    background-color: var(--gmail-bg) !important;
    font-family: var(--font-family) !important;
    color: var(--gmail-text) !important;
}

/* --- 1. COMPOSE BUTTON (THE "SCRIVI" LOOK - NON-NEGOTIABLE) --- */
/* User wants the Light Blue Filled Button from the screenshot.
   We must ensure the .sidebar-header or container isn't messing it up. */

#layout-sidebar {
    background-color: var(--gmail-sidebar-bg) !important;
    border: none !important;
    width: 256px !important;
    padding-top: 16px !important;
}

/* Target specifically the link button */
a.compose.button {
    /* FORCE THE COLOR - NO WHITE */
    background: #c2e7ff !important;
    background-color: #c2e7ff !important;
    color: #001d35 !important;

    /* SHAPE */
    border-radius: 16px !important;
    height: 56px !important;
    /* Ensure width is reasonable */
    min-width: 140px !important;
    width: fit-content !important;
    padding: 0 24px 0 0 !important;
    margin: 0 0 24px 16px !important;

    display: inline-flex !important;
    align-items: center !important;
    text-decoration: none !important;
    border: none !important;

    /* REMOVE ANY BACKGROUND IMAGE OR WEIRDNESS */
    background-image: none !important;

    /* SHADOW */
    box-shadow: none !important;
    /* Start flat */
    transition: box-shadow 0.2s, background-color 0.2s !important;
}

a.compose.button:hover {
    background-color: #d3e3fd !important;
    /* Slightly lighter blue on hover */
    box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.15) !important;
}

/* Icon */
a.compose.button i.composeicon {
    font-size: 24px !important;
    /* Larger icon */
    color: #001d35 !important;
    margin: 0 16px !important;
    width: 24px !important;
    display: flex !important;
    justify-content: center !important;
}

/* Text */
a.compose.button span.inner {
    font-weight: 500 !important;
    font-size: 14px !important;
    color: #001d35 !important;
    letter-spacing: 0.1px !important;
    /* Ensure text is visible */
    display: inline-block !important;
}

/* --- 2. HEADER & SEARCH SPACING & PADDING FIX --- */
/* User said: "border radius troppo alto" and "manca padding interno" */

#layout>.header {
    background-color: var(--gmail-bg) !important;
    height: 72px !important;
    min-height: 72px !important;
    display: flex !important;
    align-items: center !important;
    padding: 8px 16px !important;

    /* CRITICAL SPACING SEPARATION */
    margin-bottom: 24px !important;
    position: relative !important;
    z-index: 50 !important;
    /* Above list */
}

/* Search Container */
#mailsearchform {
    background-color: var(--gmail-search-bg) !important;
    /* Reduce radius slightly if requested, but Gmail is pill. V11 was 24px. */
    border-radius: 28px !important;
    height: 48px !important;
    margin: 0 16px !important;
    flex-grow: 1 !important;
    max-width: 720px !important;
    border: none !important;
    box-shadow: none !important;
    /* Ensure internal items are aligned */
    display: flex !important;
    align-items: center !important;
}

#mailsearchform input {
    background: transparent !important;
    border: none !important;
    font-size: 16px !important;
    outline: none !important;
    height: 100% !important;
    width: 100% !important;
    /* MORE PADDING inside the text field */
    padding-left: 20px !important;
    color: var(--gmail-text) !important;
}


/* --- 3. MESSAGE LIST & TOOLBAR --- */
/* Ensure the toolbar is pushed down clearly */

#layout-list {
    background: #fff !important;
    margin: 0 16px 0 0 !important;
    border-radius: 16px 16px 0 0 !important;
    border: none !important;
    /* Ensure it respects the margin of the header */
    margin-top: 0 !important;
    /* The header margin handles the gap */
    padding-top: 0 !important;
}

#messagelist-header {
    height: 48px !important;
    padding: 0 16px !important;
    border-bottom: 1px solid transparent !important;
    display: flex !important;
    align-items: center !important;
}

/* Remove Separators */
span.fromto::after,
span.subject::before {
    display: none !important;
}


/* --- 4. EDITOR "CLEAN & UNIFORM" (FIXING "ORRIBILE") --- */
/* User wants uniform fields, clean look, no ugly borders. "Invia" must be visible. */

body.action-compose {
    background-color: #ffffff !important;
    padding: 0 !important;
    overflow: hidden !important;
    /* Prevent double scrollbars */
}

/* The Container */
#layout-content {
    background: #fff !important;
    padding: 0 16px !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* Headers Table - Clean Lines & Uniform Width */
#compose-headers {
    width: 100% !important;
    background: #fff !important;
    margin: 0 !important;
    border-collapse: collapse !important;
    /* Ensure it takes full width */
    table-layout: fixed !important;
}

#compose-headers tr {
    border-bottom: 1px solid #ebebec !important;
    /* Clean separator line */
}

#compose-headers td.title {
    color: #444746 !important;
    font-size: 14px !important;
    padding: 12px 8px !important;
    vertical-align: middle !important;
    width: 80px !important;
    /* Uniform Label Width */
    font-weight: 500 !important;
    border: none !important;
}

#compose-headers td.editfield {
    padding: 0 !important;
    border: none !important;
}

/* INPUTS: Remove individual borders, make them full width inside the cell */
#compose-headers input,
#compose-headers textarea {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 12px 8px !important;
    /* Comfortable padding */
    font-size: 14px !important;
    width: 100% !important;
    outline: none !important;
    height: auto !important;
    min-height: 40px !important;
}

/* Subject Line - Make it look like a header input too */
#compose_subject {
    padding: 12px 8px !important;
    font-size: 16px !important;
    border: none !important;
    border-bottom: 1px solid #ebebec !important;
    /* Only bottom border */
    background: transparent !important;
    width: 100% !important;
}

/* Toolbar - Bottom or Top - Clean it up */
.tox-editor-header {
    background: #fff !important;
    border-bottom: 1px solid #ebebec !important;
    padding: 4px 0 !important;
}

/* --- 5. VISIBLE "INVIA" BUTTON (CRITICAL FIX) --- */
/* The Roundcube Elastic theme puts buttons in .formbuttons or footer. We must target it. */

#layout>.footer {
    display: flex !important;
    background: #fff !important;
    border-top: 1px solid #ebebec !important;
    padding: 8px 16px !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

/* Often there's a toolbar at the TOP too. Let's ensure the Main Action Button is styled wherever it is. */

a.button.mainaction {
    background-color: #0b57d0 !important;
    /* Strong Blue */
    color: #ffffff !important;

    /* PILL SHAPE */
    border-radius: 20px !important;
    padding: 0 24px !important;
    height: 36px !important;
    min-width: 80px !important;

    /* TYPOGRAPHY */
    font-weight: 500 !important;
    font-size: 14px !important;
    line-height: 36px !important;

    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    border: none !important;
    cursor: pointer !important;

    /* VISIBILITY */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    /* Position */
    margin-right: 16px !important;
}

a.button.mainaction:hover {
    background-color: #0d6efd !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}