/*
-----------------------------------------------------
9th Platform
Shared Platform Styles
Version : 1.0.0
File    : shared/ui/platform.css
-----------------------------------------------------
*/

:root {
    --purple: #7413dc;
    --purple-dark: #4f0c9e;
    --purple-light: #f4edff;
    --white: #ffffff;
    --text: #222222;
    --muted: #666666;
    --border: #e5d8f7;
    --background: #f7f3fc;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    --danger: #c62828;
    --success: #2e7d32;
    --warning: #8a5a00;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
}

body { min-height: 100vh; overflow-x: hidden; }
img { max-width: 100%; }

/* Shared platform header */
.platform-top-header {
    background: var(--purple);
    color: var(--white);
    padding: 16px 24px;
}

.platform-top-header-inner {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.platform-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.platform-brand-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.platform-brand-logo img {
    display: block;
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: contain;
}

.platform-brand-title {
    color: var(--white);
    font-size: 21px;
    font-weight: bold;
    line-height: 1.2;
}

.platform-brand-subtitle {
    color: var(--white);
    font-size: 14px;
    opacity: 0.9;
    margin-top: 2px;
}

.platform-header-actions {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-shrink: 0;
}

.platform-home-link {
    color: var(--white);
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
}

.platform-home-link:hover,
.platform-home-link:focus {
    color: var(--white);
    text-decoration: underline;
}

.platform-account-menu { position: relative; display: inline-block; }

.platform-account-button {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent !important;
    color: var(--white) !important;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.platform-account-button:hover,
.platform-account-button:focus {
    background: transparent !important;
    color: var(--white) !important;
    text-decoration: underline;
}

.platform-account-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    min-width: 230px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 5000;
}

.platform-account-menu-open .platform-account-dropdown { display: block; }

.platform-account-user {
    padding: 12px 14px;
    background: var(--purple-light);
    color: var(--text);
    font-weight: bold;
    border-bottom: 1px solid var(--border);
}

.platform-account-user span {
    color: var(--muted);
    font-size: 13px;
    font-weight: normal;
}

.platform-account-dropdown a {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border-radius: 0;
    background: var(--white);
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: bold;
    white-space: nowrap;
}

.platform-account-dropdown a:hover,
.platform-account-dropdown a:focus {
    background: var(--purple-light);
    color: var(--purple);
    text-decoration: none;
}

/* Shared application navigation */
.main-nav {
    position: relative;
    width: 100%;
    padding: 10px 24px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.main-nav a,
.main-nav button,
.main-nav .account-button {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 10px 12px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--purple-dark);
    text-decoration: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.main-nav a:hover,
.main-nav a:focus,
.main-nav button:hover,
.main-nav button:focus,
.main-nav .account-button:hover,
.main-nav .account-button:focus,
.main-nav a[aria-current="page"] {
    background: var(--purple-light);
    color: var(--purple-dark);
    text-decoration: none;
}

.main-nav-spacer,
.platform-nav-spacer { flex: 1; }

/* Main layout */
.container {
    width: 100%;
    max-width: 1500px;
    margin: 28px auto;
    padding: 0 28px;
}

.card {
    margin-bottom: 20px;
    padding: 22px;
    border-radius: 14px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.card h1, .card h2, .card h3 { margin-top: 0; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.stat-card {
    min-width: 0;
    padding: 18px;
    border-radius: 14px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.stat-card h3 { margin-top: 0; color: var(--purple-dark); }
.big-number, .number { margin: 8px 0; color: var(--purple); font-size: 36px; font-weight: bold; }

/* Buttons */
button, .button, a.button, .quick-button {
    display: inline-block;
    width: auto;
    margin: 2px 5px 5px 0;
    padding: 10px 15px;
    border: none;
    border-radius: 9px;
    background: var(--purple);
    color: var(--white);
    text-decoration: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

button:hover, button:focus,
.button:hover, .button:focus,
a.button:hover, a.button:focus,
.quick-button:hover, .quick-button:focus {
    background: var(--purple-dark);
    color: var(--white);
    text-decoration: none;
}

.button-secondary { background: var(--purple-light); color: var(--purple-dark); }
.button-secondary:hover, .button-secondary:focus { background: var(--border); color: var(--purple-dark); }
.button-danger, .archive-button { background: var(--danger); }
.button-danger:hover, .archive-button:hover { background: #a61f1f; }

/* Forms */
.form-group { margin-bottom: 15px; }
label, .form-group label { display: block; margin-bottom: 5px; font-weight: bold; }

input, select, textarea {
    width: 100%;
    max-width: 500px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
}

textarea { min-height: 100px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; max-width: none; margin: 0; }
.checkbox-row label { display: inline-flex; align-items: center; gap: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--purple-light); border-color: var(--purple); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--purple-dark); font-weight: bold; }
tbody tr:hover { background: var(--purple-light); }
td a { color: var(--purple-dark); font-weight: bold; }

/* Alerts and status */
.notice, .error, .success, .warning-box, .success-box {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 0 0 16px;
}

.notice, .warning-box { background: var(--purple-light); border-left: 4px solid var(--purple); }
.error { background: #ffecec; border-left: 4px solid var(--danger); }
.success, .success-box { background: #eefbea; border-left: 4px solid var(--success); }

.status-badge { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 13px; font-weight: bold; }
.status-active { background: #eefbea; color: var(--success); }
.status-disabled { background: #ffecec; color: var(--danger); }
.status-warning { background: #fff8e1; color: var(--warning); }

/* Login */
.login-card { max-width: 720px; margin: 48px auto; padding: 44px; text-align: center; }
.login-title { margin-bottom: 24px; color: var(--purple); font-size: 46px; line-height: 1.1; }
.login-divider { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 10px 0 28px; }
.login-divider-line { width: 180px; height: 2px; background: var(--border); }
.login-logo { display: block; width: 54px; height: 54px; object-fit: contain; }
.login-form { max-width: 520px; margin: 0 auto; text-align: left; }
.login-form label { color: var(--purple-dark); font-size: 20px; font-weight: bold; }
.login-form input { max-width: 100%; margin-top: 6px; margin-bottom: 18px; padding: 14px; font-size: 18px; }
.login-form button { width: 100%; margin-top: 8px; padding: 14px; font-size: 18px; }

/* Footer */
.site-footer, .footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--white);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.site-footer a, .footer a { color: var(--purple); font-weight: bold; text-decoration: none; }
.site-footer a:hover, .footer a:hover { text-decoration: underline; }

@media screen and (max-width: 800px) {
    .platform-top-header { padding: 14px 16px; }
    .platform-top-header-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .platform-brand { gap: 12px; }
    .platform-brand-logo { width: 42px; height: 42px; flex-basis: 42px; }
    .platform-brand-logo img { width: 38px !important; height: 38px !important; max-width: 38px !important; max-height: 38px !important; }
    .platform-brand-title { font-size: 18px; }
    .platform-brand-subtitle { font-size: 13px; }
    .platform-header-actions { width: 100%; justify-content: space-between; gap: 16px; }
    .platform-home-link, .platform-account-button { font-size: 14px; }
    .platform-account-dropdown { right: 0; min-width: 230px; }
    .main-nav { padding: 10px; gap: 8px; flex-wrap: nowrap; overflow-x: auto; }
    .main-nav a, .main-nav button, .main-nav .account-button { padding: 9px 10px; font-size: 14px; }
    .container { max-width: 100%; margin: 0 auto; padding: 14px; }
    .card, .stat-card { padding: 16px; }
    input, select, textarea { max-width: 100%; }
    .login-card { margin: 20px auto; padding: 24px; }
    .login-title { font-size: 32px; }
    .login-divider-line { width: 90px; }
    .login-logo { width: 46px; height: 46px; }
}

@media screen and (max-width: 520px) {
    .main-nav-spacer, .platform-nav-spacer { display: none; }
    .card h1 { font-size: 24px; }
    .card h2 { font-size: 20px; }
    button, .button, a.button, .quick-button { width: 100%; margin-right: 0; text-align: center; }
}
