
//
// variables
//

@min-width: 820px;  // Below this width some elements looks so ugly it is better to have a horizontal scrollbar.
@content-max-width: 1024px; // Max with of content (controls, tables, text etc, but not graphs).
@hide-logo-width: 980px;

@the-color: #84B585;
@sub-nav-bg: #eeeeee;
@footer-color: #909090;
@text-color: #000000;

//
// main styles
//

body {
    background: white;
    font-family: 'Open Sans', Helvetica, Arial, sans-serif;
    font-size: 14px;
    margin: 0;
    padding: 0;
    textarea {
        font-size: 14px;
        font-family: 'Open Sans', Helvetica, Arial, sans-serif;
    }
}

button {
    background: @the-color;
    border: 1px solid black;
    margin: 0;
    cursor: pointer;
}

input {
    margin: 0px -1px 0px 0px;
    border: 1px solid black;
}

input::-webkit-input-placeholder {
    color: #606060;
}
input::-moz-placeholder {
    color: #606060;
}

input, button {
    &:focus {
        box-shadow: 0 0 2px black inset;
    }
}

span.icon-align {
    line-height: 17px;
}
@supports (-moz-appearance:none) {
    span.icon-align {
        position: relative;
        top: 2px;
    }
}

img.region, img.league, img.race {
    vertical-align: bottom;
}

h1 {
    font-size: 1.7em;
    font-weight: 200;
    margin: 32px 0px 20px 0px;
}

h2 {
    font-size: 1.17em;
    font-weight: 500;
    margin: 28px 0px 16px 0px;
}

p {
    margin: 16px 0px 20px 0px;
    line-height: 1.3em;
}

a, a.visited {
    color: darken(@the-color, 20%);
    text-decoration: none;
    &:hover, &:focus {
        text-decoration: underline;
        color: darken(@the-color, 30%);
    }
}

.tag {
    font-weight: bold;
    padding: 0px 2px 0px 0px;
}

.footer {
    font-size: 12px;
    color: @footer-color;
    margin-top: 32px;
    margin-bottom: 100px;
    border-top: 1px solid black;
    padding: 20px 0px 20px 0px;

    a, a.visited {
        border-left: 1px solid @footer-color;
        padding: 0px 6px;
        color:  @footer-color;
        &:first-child {
            border-left: none;
        }
        &:hover, &:focus {
            color: darken(@footer-color, 30%);
        }
    }

    .last-updated {
        float: right;
        display: inline-block;
    }
}

.content {
    max-width: @content-max-width;
    margin: 0 auto;
}

.pagination {
    padding: 0;
    list-style-type: none;
    
    li {
        padding: 0px 2px 0px 2px;
        display: inline-block;
    }
}

// A site message that goes on top of the page.
.message {
    margin: 16px 0;
    padding: 0px 16px;
    p {
        max-width: @content-max-width;
        margin: 8px auto 8px auto;
    }
    strong {
        font-weight: bold;
    }
    background: #fff8d0;
    border-top: 1px solid #808050;
    border-bottom: 1px solid #808050;
}

//
// Navigation.
//

.top-nav {
    min-width: @min-width;

    .logo {
        font-weight: bold;
        margin-left: 0px;
        padding-left: 0px;
        @media all and (max-width: @hide-logo-width) {
            display: none;
        }
    }

    a, span {
        padding: 5px 10px 3px 10px;  // Different paddings to make text appear to be centered.
        display: inline-block;
        margin: 0px;
    }
    
    a, a.visited {
        color: black;
        &:hover, &:focus {
            text-decoration: none;
            background: darken(@the-color, 25%);
        }
    }

    a.visiting {
        background: darken(@the-color, 20%);
    }

    form.search {
        float: right;
        padding: 2px 0px;
        margin: 0;
        display: block;
        input {
            width: 254px;
            height: 16px;
            background: @sub-nav-bg;
        }
        button {
            display: none;
        }
    }
    
    background: @the-color;
    border-top: 1px solid black;
    border-bottom: 1px solid black;
    margin: 16px 0px 0px 0px;
    font-size: 18px;
    line-height: 22px;
}

.sub-nav {
    min-width: @min-width;

    a {
        line-height: 17px;
        padding: 3px 10px 3px 10px;
        display: inline-block;
        margin: 0px;
        &:first-child {
            margin-left: -10px;
        }
    }
    
    a, a:visited {
        color: black;
        &:hover, &:focus {
            text-decoration: none;
            background: darken(@sub-nav-bg, 30%);
        }
    }

    a.visiting {
        background: darken(@sub-nav-bg, 25%);
    }

    span {
        &.heading {
            font-weight: bold;
        }
        line-height: 17px;
    }

    @supports (-moz-appearance:none) {
        span {
            position: relative;
            top: 2px;
        }
    }

    .control {
        display: inline-block;
        border-bottom: 1px solid black;
        border-top: 1px solid black;
        margin: -1px 0px -1px 0px;
    }
    
    background: @sub-nav-bg;
    border-bottom: 1px solid black;
    border-top: 1px solid black;
    margin: -1px 0px -1px 0px;
}


//
// Graphs and tables.
//

.tooltip {
    display: none;
    position: absolute;
    background: @the-color;
    border: 1px solid black;
    color: black;
    td.date, td.season {
        text-align: left;
    }
    td, th, tr {
        margin: 0;
        padding: 0;
        font-size: 12px;
        font-family: sans-serif;
        font-weight: normal;
    }
    th {
        text-align: right;
        padding-right: 4px;
    }
}

.data-container {
    min-width: @min-width;
    background: black;
    width: 100%;
    color: white;
        
    &.wait {
        background: black url("img/wait.gif") center center no-repeat;
    }

    table {
        padding: 6px 0px;
        
        thead th {
            text-align: center;
            text-transform: capitalize;
            img {
                padding: 0px 5px 0px 32px;
            }
        }
            
        tbody th {
            text-transform: capitalize;
            text-align: right;
            img {
                padding: 0px 0px 0px 5px;
            }
            &.no-img {
                padding-right: 21px;
            }
        }

        span {
            display: inline-block;
        }

        td {
            padding: 0px;
            text-align: right;
        }
        
        .percent {
            margin-left: 3px;
            width: 65px;
        }
            
        width: 100%;
    }

    .controls {
        border-top: 1px solid black;
        background: @the-color;
        color: @text-color;
        .content {
            min-height: 20px;  // Make the controls take the expected height before actual controls are in place.
        }
        ul:first-child { margin-left: 0px };
        ul {
            list-style-type: none;
            padding: 0;
            margin: 0px 6px;
            display: inline-block;

            > span {
                display: inline-block;
                font-weight: bold;
            }
            
            a {
                color: @text-color;
                padding: 2px 3px;
                display: inline-block;
                
                &.selected {
                    background: darken(@the-color, 20%);
                }
                &:hover {
                    background: darken(@the-color, 25%);
                }

                img {
                    cursor: pointer;
                    padding: 0px 0px 0px 2px;
                }

                span {
                    cursor: pointer;
                    display: inline-block;
                }
            }
        }
        ul.ra a img {
            padding-left: 0;
        }
    }
}

//
// Main page.
//

body.main {
    
    form.search {
        margin-top: 40px;
        margin-bottom: 80px;

        input, button {
            padding: 2px 4px;
        }
    }

    .center {
        text-align: center; 
        p {
            line-height: 1.4em;
            padding: 0px 20px;
        }
    }

    h1 {
        margin: 32px 0px 0px 0px;
        letter-spacing: 1px;    
        font-size: 2em;
        font-weight: normal;
    }
    
    h5.tagline {
        margin: 3px 0px 32px 0px;
        font-weight: 100;
        font-size: 1em;
        letter-spacing: 2px;    
    }

    .img {
        color: white;
        background: black;
        padding-bottom: 6px;
        display: inline-block;
        margin: 0px 12px 20px 12px;
        box-shadow: 0 0 12px black;
    }
    
}

//
// Stats pages.
//

body.stats-population {
    table.table {
        th {
            text-align: right;
        }
        width: 26%;
        min-width: 200px;
        margin-left: 8%;
    }
}

//
// Team page.
//

body.team {
    .tooltip td {
        text-align: left;
    }
}

//
// Ladder page (and clan ladder page).
//

body.ladder {

    .server-error {
        color: red;
        font-size: 2em;
        width: 100%;
        padding: 100px 0 100px 0;
        text-align: center;
    }

    .sub-nav {
        .control {
            margin-right: 16px;
            @media screen and (max-width: 750px) {
                width: 100%;
                &:not(:first-child) { // Hack to make borders overlap again.
                    margin: 0px 0px -1px 0px;
                }
            }
        }

        .compact {
            a {
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    }

    .pagination b {
        margin: 0 2px 0  -2px; // Have no idea why this is needed on this page.
    }    

    .table {
        min-width: @min-width;
        font-size: 0.9em;
        width: 100%;
        border-collapse: collapse;
        display: table;

        a {
            color: @text-color;
            &:visited {
                color: @text-color;
            }
            &:hover {
                text-decoration: none;
            }
        }

        .highlight-team {
            background: lighten(@the-color, 20%);
        }
        
        .row {
            display: table-row;

            &:hover {
                background: darken(#ffffff, 25%);
            }
        }

        .cell {
            display: table-cell;
            padding: 4px 6px 4px 2px;
            vertical-align: text-bottom;
        }

        .heading {
            font-weight: bold;
            text-align: center;
            &.number, &.mmr {
                margin-top: 1px;
            }
        }

        .cell:first-child {
            width: 10px;
        }

        .team-header {
            width: 200px;
        }

        .number, .mmr {
            text-align: right;
        }

        .img {
            text-align: center;
        }
        
        .player {
            text-align: left;
        }

        &.team-size-4 .tag {
            display: none;
        }

        &.team-size-3 { @media screen and (max-width: 980px) { .tag {
            display: none;
        }}}

        &.team-size-2 { @media screen and (max-width: 820px) { .tag {
            display: none;
        }}}
    }

    .count {
        font-size: 0.9em;
        color: lighten(black, 40%);
    }
}

//
// Player page.
//

body.player {

    h1 {
        margin-bottom: 6px;
    }
    
    .bnet-link {
        display: block;
        margin-bottom: 32px;
    }
    
    ul.teams {

        a {
            color: black;
            &:active {
                outline: 0;
            }
            &:hover {
                text-decoration: none;
            }
        }

        padding: 0;
        list-style-type: none;

        li {
            padding: 0;
            border: 1px solid black;
            margin: -1px 0px 0px 0px;

            a {
                padding: 3px 3px 4px 3px;
                display: inline-block;
                margin: 0px;
            }
            
            .ladder {
                width: 18px;
            }

            .team {
                width: 13%;
                min-width: 100px;
            }
            
            .player {
                width: 19%;
                min-width: 120px;
                @media screen and (max-width: 1000px) {
                    span.tag {
                        display: none;
                    }
                }
            }

            img, span {
                margin: -2px 0px 0px 0px;
                display: inline-block;
            }

            &:nth-child(2n) {
                background: lighten(@the-color, 15%);
                a:focus, a:hover {
                    background: lighten(@the-color, -10%);
                }
            }

            &:nth-child(2n+1) {
                background: lighten(@the-color, 25%);
                a:hover, a:focus {
                    background: lighten(@the-color, 0%);
                }
            }
        }
    }
}

//
// search result.
//

body.search {
    .count {
        font-size: 10px;
        color: lighten(black, 40%);
    }

    .result {
        padding: 0;
        list-style-type: none;

        a {
            color: black;
            &:active {
                outline: 0;
            }
            &:hover {
                text-decoration: none;
            }
        }
        
        li {
            padding: 3px;
            border: 1px solid black;
            margin: -1.1px 0px 0px 0px;

            img, span {
                margin: 0px 3px;
                display: inline-block;
            }

            .number {
                min-width: 30px;
            }
            
            .region-name {
                min-width: 40px;
            }

            .race {
                margin: 0px 10px;
            }
            
            .name {
                margin: 0;
            }
        }
        
        a:nth-child(2n) {
            li {
                background: lighten(@the-color, 15%);
            }
            &:focus li, &:hover li {
                background: lighten(@the-color, -10%);
            }
        }
        a:nth-child(2n+1) {
            li {
                background: lighten(@the-color, 25%);
            }
            &:hover li, &:focus li {
                background: lighten(@the-color, 0%);
            }
        }
    }
}

//
// clan search result
//

body.clan-search {
    .result {
        min-width: @min-width;
        padding: 0;
        list-style-type: none;

        a {
            color: black;
            &:active {
                outline: 0;
            }
            &:hover {
                text-decoration: none;
            }
        }
        
        li {
            padding: 3px;
            border: 1px solid black;
            margin: -1px 0px 0px 0px;
            height: 16px;  // Some chars are 19 px high...

            span {
                display: inline-block;
            }
            
            .tag {
                min-width: 80px;
            }

            .name {
                min-width: 400px;
            }

            .count {
                text-align: right;
                min-width: 100px;
            }
        }
        
        a:nth-child(2n) {
            li {
                background: lighten(@the-color, 15%);
            }
            &:focus li, &:hover li {
                background: lighten(@the-color, -10%);
            }
        }
        a:nth-child(2n+1) {
            li {
                background: lighten(@the-color, 25%);
            }
            &:hover li, &:focus li {
                background: lighten(@the-color, 0%);
            }
        }
    }
}
